架构重新设计
基本重做了所有物体和次级模块代码
This commit is contained in:
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Dreamteck.Splines;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
@@ -9,7 +10,7 @@ using UnityEngine.Serialization;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class GameCamera : BaseElement
|
||||
public partial class GameCamera : GameElement, IHaveTransformSubmodule, IHaveTimeDurationSubmodule
|
||||
{
|
||||
public Camera camera;
|
||||
public Transform rotationPoint;
|
||||
@@ -20,28 +21,34 @@ namespace Ichni.RhythmGame
|
||||
public float perspectiveAngle;
|
||||
public float orthographicSize;
|
||||
|
||||
public TransformSubmodule transformSubmodule { get; set; }
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
|
||||
public static GameCamera GenerateElement(string elementName, Guid id,
|
||||
List<string> tags, BaseElement parentElement,
|
||||
CameraViewType cameraViewType, float perspectiveAngle, float orthographicSize,
|
||||
Vector3 initialPosition, Vector3 initialEulerAngles)
|
||||
List<string> tags, bool isFirstGenerated, GameElement parentElement,
|
||||
CameraViewType cameraViewType, float perspectiveAngle, float orthographicSize)
|
||||
{
|
||||
GameCamera gameCamera =
|
||||
Instantiate(EditorManager.instance.basePrefabs.gameCamera).GetComponent<GameCamera>();
|
||||
|
||||
gameCamera.Initialize(elementName, id, tags);
|
||||
gameCamera.Initialize(elementName, id, tags, isFirstGenerated);
|
||||
gameCamera.parentElement = parentElement;
|
||||
gameCamera.cameraViewType = cameraViewType;
|
||||
gameCamera.camera.orthographic = cameraViewType == CameraViewType.Orthographic;
|
||||
gameCamera.perspectiveAngle = perspectiveAngle;
|
||||
gameCamera.orthographicSize = orthographicSize;
|
||||
gameCamera.transformSubmodule =
|
||||
new TransformSubmodule(gameCamera, initialPosition, initialEulerAngles, Vector3.one);
|
||||
gameCamera.cameraTransform = gameCamera.transform;
|
||||
|
||||
gameCamera.SetParent(parentElement);
|
||||
|
||||
return gameCamera;
|
||||
}
|
||||
|
||||
protected override void SetDefaultSubmodules()
|
||||
{
|
||||
transformSubmodule = new TransformSubmodule(this);
|
||||
submoduleList.Add(transformSubmodule);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class GameCamera
|
||||
@@ -56,7 +63,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public partial class GameCamera
|
||||
{
|
||||
public override void SetTransformObserver()
|
||||
public void SetTransformObserver()
|
||||
{
|
||||
Observable.EveryUpdate().Subscribe(_ =>
|
||||
{
|
||||
@@ -97,21 +104,18 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.GameCamera_BM(elementName, elementGuid, tags, parentElement.matchedBM,
|
||||
cameraViewType, perspectiveAngle, orthographicSize, transformSubmodule.currentPosition,
|
||||
transformSubmodule.currentEulerAngles);
|
||||
matchedBM = new GameCamera_BM(elementName, elementGuid, tags,
|
||||
parentElement.matchedBM as GameElement_BM, cameraViewType, perspectiveAngle, orthographicSize);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class GameCamera_BM : BaseElement_BM
|
||||
public class GameCamera_BM : GameElement_BM
|
||||
{
|
||||
public GameCamera.CameraViewType cameraViewType;
|
||||
public float perspectiveAngle;
|
||||
public float orthographicSize;
|
||||
public Vector3 initialPosition;
|
||||
public Vector3 initialEulerAngles;
|
||||
|
||||
public GameCamera_BM()
|
||||
{
|
||||
@@ -119,28 +123,25 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
|
||||
public GameCamera_BM(string elementName, Guid elementGuid, List<string> tags,
|
||||
BaseElement_BM attachedElement,
|
||||
GameCamera.CameraViewType cameraViewType, float perspectiveAngle, float orthographicSize,
|
||||
Vector3 initialPosition, Vector3 initialEulerAngles)
|
||||
GameElement_BM attachedElement, GameCamera.CameraViewType cameraViewType,
|
||||
float perspectiveAngle, float orthographicSize)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.cameraViewType = cameraViewType;
|
||||
this.perspectiveAngle = perspectiveAngle;
|
||||
this.orthographicSize = orthographicSize;
|
||||
this.initialPosition = initialPosition;
|
||||
this.initialEulerAngles = initialEulerAngles;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
GameCamera.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid),
|
||||
cameraViewType, perspectiveAngle, orthographicSize, initialPosition, initialEulerAngles);
|
||||
GameCamera.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid), cameraViewType, perspectiveAngle, orthographicSize);
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return GameCamera.GenerateElement(elementName, elementGuid, tags, parent, cameraViewType,
|
||||
perspectiveAngle, orthographicSize, initialPosition, initialEulerAngles);
|
||||
return GameCamera.GenerateElement(elementName, elementGuid, tags, false,
|
||||
parent, cameraViewType, perspectiveAngle, orthographicSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user