架构重新设计
基本重做了所有物体和次级模块代码
This commit is contained in:
@@ -7,25 +7,32 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class ElementFolder : BaseElement
|
||||
public partial class ElementFolder : GameElement, IHaveTransformSubmodule, IHaveTimeDurationSubmodule
|
||||
{
|
||||
public List<Track> trackList;
|
||||
public TransformSubmodule transformSubmodule { get; set; }
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
|
||||
public static ElementFolder GenerateElement(string name, Guid id, List<string> tags, BaseElement parentElement)
|
||||
public static ElementFolder GenerateElement(string name, Guid id, List<string> tags, bool isFirstGenerated, GameElement parentElement)
|
||||
{
|
||||
ElementFolder elementFolder = Instantiate(EditorManager.instance.basePrefabs.elementFolder).GetComponent<ElementFolder>();
|
||||
|
||||
elementFolder.Initialize(name, id, tags);
|
||||
elementFolder.Initialize(name, id, tags, isFirstGenerated);
|
||||
elementFolder.SetParent(parentElement);
|
||||
|
||||
elementFolder.transformSubmodule = new TransformSubmodule(elementFolder);
|
||||
elementFolder.timeDurationSubmodule = new TimeDurationSubmodule(elementFolder);
|
||||
//elementFolder.GenerateTab(parentElement);
|
||||
|
||||
elementFolder.SetTransformObserver();
|
||||
|
||||
return elementFolder;
|
||||
}
|
||||
|
||||
protected override void SetDefaultSubmodules()
|
||||
{
|
||||
transformSubmodule = new TransformSubmodule(this);
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
|
||||
submoduleList.Add(transformSubmodule);
|
||||
submoduleList.Add(timeDurationSubmodule);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class ElementFolder
|
||||
@@ -33,21 +40,21 @@ namespace Ichni.RhythmGame
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = parentElement != null ?
|
||||
new ElementFolder_BM(elementName, elementGuid, tags, parentElement.matchedBM) :
|
||||
new ElementFolder_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM) :
|
||||
new ElementFolder_BM(elementName, elementGuid, tags, null);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class ElementFolder_BM : BaseElement_BM
|
||||
public class ElementFolder_BM : GameElement_BM
|
||||
{
|
||||
public ElementFolder_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ElementFolder_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM attachedElement)
|
||||
public ElementFolder_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
|
||||
@@ -55,12 +62,12 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = ElementFolder.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid));
|
||||
matchedElement = ElementFolder.GenerateElement(elementName, elementGuid, tags,false, GetElement(attachedElementGuid));
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return ElementFolder.GenerateElement(elementName, elementGuid, tags, parent);
|
||||
return ElementFolder.GenerateElement(elementName, elementGuid, tags, false, parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -10,16 +11,14 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public bool isStatic;
|
||||
|
||||
public static SubstantialObject GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
string themeBundleName, string objectName, BaseElement parent,
|
||||
Vector3 position, Vector3 eulerAngles, Vector3 scale,
|
||||
bool isStatic, bool isFirstGenerated = true)
|
||||
public static SubstantialObject GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
bool isFirstGenerated, GameElement parent, string themeBundleName, string objectName, bool isStatic)
|
||||
{
|
||||
EnvironmentObject themeBundleObject =
|
||||
ThemeBundleManager.instance.GetObject<EnvironmentObject>(themeBundleName, objectName);
|
||||
EnvironmentObject environmentObject =
|
||||
Instantiate(themeBundleObject, parent.transform).GetComponent<EnvironmentObject>();
|
||||
environmentObject.Initialize(elementName, id, tags);
|
||||
environmentObject.Initialize(elementName, id, tags, isFirstGenerated);
|
||||
environmentObject.isStatic = isStatic;
|
||||
return environmentObject;
|
||||
}
|
||||
@@ -29,17 +28,15 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.EnvironmentObject_BM(elementName, elementGuid, tags, parentElement.matchedBM,
|
||||
themeBundleName, objectName, isStatic);
|
||||
matchedBM = new EnvironmentObject_BM(elementName, elementGuid, tags,
|
||||
parentElement.matchedBM as GameElement_BM, themeBundleName, objectName, isStatic);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class EnvironmentObject_BM : BaseElement_BM
|
||||
public class EnvironmentObject_BM : SubstantialObject_BM
|
||||
{
|
||||
public string themeBundleName;
|
||||
public string objectName;
|
||||
public bool isStatic;
|
||||
|
||||
public EnvironmentObject_BM()
|
||||
@@ -48,26 +45,22 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
|
||||
public EnvironmentObject_BM(string elementName, Guid elementGuid, List<string> tags,
|
||||
BaseElement_BM attachedElement, string themeBundleName, string objectName, bool isStatic)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
GameElement_BM attachedElement, string themeBundleName, string objectName, bool isStatic)
|
||||
: base(elementName, elementGuid, tags, attachedElement, themeBundleName, objectName)
|
||||
{
|
||||
this.themeBundleName = themeBundleName;
|
||||
this.objectName = objectName;
|
||||
this.isStatic = isStatic;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = EnvironmentObject.GenerateElement(elementName, elementGuid, tags,
|
||||
themeBundleName, objectName, GetElement(attachedElementGuid),
|
||||
Vector3.zero, Vector3.zero, Vector3.one, isStatic, false);
|
||||
matchedElement = EnvironmentObject.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid), themeBundleName, objectName, isStatic);
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return EnvironmentObject.GenerateElement(elementName, elementGuid, tags,
|
||||
themeBundleName, objectName, parent,
|
||||
Vector3.zero, Vector3.zero, Vector3.one, isStatic, false);
|
||||
return EnvironmentObject.GenerateElement(elementName, elementGuid, tags, false,
|
||||
parent, themeBundleName, objectName, isStatic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
192
Assets/Scripts/GameElements/GameElement.cs
Normal file
192
Assets/Scripts/GameElements/GameElement.cs
Normal file
@@ -0,0 +1,192 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public abstract partial class GameElement : SerializedMonoBehaviour, IBaseElement
|
||||
{
|
||||
//物体名
|
||||
public string elementName;
|
||||
|
||||
//标识 GUID
|
||||
public Guid elementGuid;
|
||||
|
||||
//标签
|
||||
public List<string> tags;
|
||||
|
||||
//父游戏物体
|
||||
public GameElement parentElement;
|
||||
|
||||
//子物体列表
|
||||
public List<GameElement> childElementList = new List<GameElement>();
|
||||
|
||||
//次级模块
|
||||
public List<SubmoduleBase> submoduleList = new List<SubmoduleBase>();
|
||||
|
||||
//存档类
|
||||
public BaseElement_BM matchedBM { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 首次初始化
|
||||
/// </summary>
|
||||
/// <param name="name">物体名</param>
|
||||
public virtual void Initialize(string name, Guid elementGuid, List<string> tags, bool isFirstGenerated)
|
||||
{
|
||||
this.elementName = name;
|
||||
this.elementGuid = elementGuid;
|
||||
this.tags = tags;
|
||||
EditorManager.instance.elementList.Add(this);
|
||||
submoduleList = new List<SubmoduleBase>();
|
||||
if (isFirstGenerated)
|
||||
{
|
||||
SetDefaultSubmodules();
|
||||
}
|
||||
//GameManager.beatMapContainer.beatMapElementList.Add(this);
|
||||
//serialNumber = totalSerialNumber++;
|
||||
//SetTransformObserver();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置次级模块
|
||||
/// </summary>
|
||||
protected abstract void SetDefaultSubmodules();
|
||||
|
||||
/// <summary>
|
||||
/// 在所有物体生成完毕后,执行的初始化方法
|
||||
/// </summary>
|
||||
public virtual void AfterInitialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刷新物体的状态
|
||||
/// </summary>
|
||||
public virtual void Refresh()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置父物体
|
||||
/// </summary>
|
||||
/// <param name="parentElement">父物体</param>
|
||||
public void SetParent(GameElement parentElement)
|
||||
{
|
||||
if (parentElement != null)
|
||||
{
|
||||
parentElement.childElementList.Add(this);
|
||||
this.parentElement = parentElement;
|
||||
transform.SetParent(parentElement.transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public abstract partial class GameElement //存档,删除,复制,粘贴
|
||||
{
|
||||
/// <summary>
|
||||
/// 用于生成存档
|
||||
/// </summary>
|
||||
public virtual void SaveBM()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当物体被删除时执行的方法
|
||||
/// </summary>
|
||||
public virtual void OnDelete()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除物体,包括所有子物体
|
||||
/// </summary>
|
||||
public virtual void Delete()
|
||||
{
|
||||
if (this.childElementList != null)
|
||||
{
|
||||
for (int i = 0; i < childElementList.Count; i++)
|
||||
{
|
||||
childElementList[i].Delete(); //删除子GameElement、
|
||||
}
|
||||
}
|
||||
|
||||
OnDelete();
|
||||
|
||||
#if UNITY_EDITOR
|
||||
Debug.Log("Delete " + elementName + "(" + elementGuid + ")");
|
||||
#endif
|
||||
EditorManager.instance.elementList.Remove(this); //从保存列表中剔除
|
||||
this.parentElement.childElementList.Remove(this);
|
||||
Destroy(gameObject); //销毁
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
[System.Serializable]
|
||||
public abstract class GameElement_BM : BaseElement_BM
|
||||
{
|
||||
[System.NonSerialized]
|
||||
public static Dictionary<Guid, GameElement_BM> identifier = new(); //存档类的标识符
|
||||
|
||||
[System.NonSerialized]
|
||||
public GameElement matchedElement; //存档类对应的游戏物体
|
||||
|
||||
public string elementName;
|
||||
public List<string> tags;
|
||||
public Guid elementGuid;
|
||||
public Guid attachedElementGuid;
|
||||
|
||||
public GameElement_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public GameElement_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement)
|
||||
{
|
||||
this.elementName = elementName;
|
||||
this.elementGuid = elementGuid;
|
||||
this.tags = tags;
|
||||
|
||||
this.attachedElementGuid = attachedElement?.elementGuid ?? Guid.Empty;
|
||||
|
||||
identifier.TryAdd(this.elementGuid, this);
|
||||
}
|
||||
|
||||
public static GameElement_BM GetElementBM(Guid id)
|
||||
{
|
||||
if (identifier.TryGetValue(id, out GameElement_BM element_BM))
|
||||
{
|
||||
return element_BM;
|
||||
}
|
||||
|
||||
Debug.LogAssertion("Element not found or do not have id");
|
||||
return null;
|
||||
}
|
||||
|
||||
public static GameElement GetElement(Guid id)
|
||||
{
|
||||
return GetElementBM(id)?.matchedElement;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从存档类中生成游戏物体
|
||||
/// </summary>
|
||||
public abstract void ExecuteBM();
|
||||
|
||||
/// <summary>
|
||||
/// 复制物体
|
||||
/// </summary>
|
||||
/// <param name="attached">(对于物体)父物体,(对于次级模块)或挂载物体</param>
|
||||
public abstract GameElement DuplicateBM(GameElement attached);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/GameElements/GameElement.cs.meta
Normal file
11
Assets/Scripts/GameElements/GameElement.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9c0f3bb048a794215a0356fece54702f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using MoreMountains.Feedbacks;
|
||||
using MoreMountains.FeedbacksForThirdParty;
|
||||
@@ -22,5 +23,10 @@ namespace Ichni.RhythmGame
|
||||
effect.PlayFeedbacks();
|
||||
LeanPool.Despawn(effect.gameObject, bloomTime);
|
||||
}
|
||||
|
||||
public override EffectBase_BM ConvertToBM()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Dreamteck.Splines;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
@@ -11,18 +12,20 @@ namespace Ichni.RhythmGame
|
||||
public partial class Flick : NoteBase
|
||||
{
|
||||
public List<Vector2> availableFlickDirections;
|
||||
public static Flick GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
float exactJudgeTime, BaseElement attach, List<Vector2> directions)
|
||||
|
||||
public static Flick GenerateElement(string elementName, Guid id, List<string> tags, bool isFirstGenerated,
|
||||
GameElement parentElement, float exactJudgeTime, List<Vector2> directions)
|
||||
{
|
||||
Flick flick = Instantiate(EditorManager.instance.basePrefabs.tapNote, attach.transform).GetComponent<Flick>();
|
||||
flick.Initialize(elementName, id, tags);
|
||||
Flick flick = Instantiate(EditorManager.instance.basePrefabs.tapNote, parentElement.transform)
|
||||
.GetComponent<Flick>();
|
||||
flick.Initialize(elementName, id, tags, isFirstGenerated);
|
||||
flick.exactJudgeTime = exactJudgeTime;
|
||||
flick.availableFlickDirections = directions;
|
||||
flick.transformSubmodule = new TransformSubmodule(flick);
|
||||
flick.timeDurationSubmodule = new TimeDurationSubmodule(flick);
|
||||
flick.SetParent(attach);
|
||||
|
||||
if (attach.TryGetComponent(out Track track))
|
||||
flick.SetParent(parentElement);
|
||||
|
||||
if (parentElement.TryGetComponent(out Track track))
|
||||
{
|
||||
if (track.trackTimeSubmodule != null)
|
||||
{
|
||||
@@ -46,41 +49,44 @@ namespace Ichni.RhythmGame
|
||||
return flick;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public partial class Flick
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.Flick_BM(elementName, elementGuid, tags, parentElement.matchedBM, exactJudgeTime, availableFlickDirections);
|
||||
matchedBM = new Flick_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
|
||||
exactJudgeTime, availableFlickDirections);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class Flick_BM : BaseElement_BM
|
||||
public class Flick_BM : NoteBase_BM
|
||||
{
|
||||
public float exactJudgeTime;
|
||||
public List<Vector2> availableFlickDirections;
|
||||
|
||||
public Flick_BM()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Flick_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM attachedElement, float exactJudgeTime, List<Vector2> directions)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
public Flick_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,
|
||||
float exactJudgeTime,
|
||||
List<Vector2> directions) : base(elementName, elementGuid, tags, attachedElement, exactJudgeTime)
|
||||
{
|
||||
this.exactJudgeTime = exactJudgeTime;
|
||||
availableFlickDirections = directions;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = Flick.GenerateElement(elementName, elementGuid, tags, exactJudgeTime, GetElement(attachedElementGuid), availableFlickDirections);
|
||||
matchedElement = Flick.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid), exactJudgeTime, availableFlickDirections);
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return Flick.GenerateElement(elementName, elementGuid, tags, exactJudgeTime, parent, availableFlickDirections);
|
||||
return Flick.GenerateElement(elementName, elementGuid, tags, false, parent,
|
||||
exactJudgeTime, availableFlickDirections);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
@@ -8,14 +9,14 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public List<NoteJudgeUnit> judgeUnitList;
|
||||
|
||||
public NoteJudgeSubmodule(BaseElement attachedElement) : base(attachedElement)
|
||||
public NoteJudgeSubmodule(NoteBase attachedGameElement) : base(attachedGameElement)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.NoteJudgeSubmodule_BM(attachedElement);
|
||||
matchedBM = new NoteJudgeSubmodule_BM(attachedGameElement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,18 +31,18 @@ namespace Ichni.RhythmGame
|
||||
|
||||
}
|
||||
|
||||
public NoteJudgeSubmodule_BM(BaseElement attachedElement) : base(attachedElement)
|
||||
public NoteJudgeSubmodule_BM(GameElement attachedElement) : base(attachedElement)
|
||||
{
|
||||
judgeUnitList = new List<NoteJudgeUnit>();
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
attachedElement = GetElement(attachedElementGuid);
|
||||
attachedElement = GameElement_BM.GetElement(attachedElementGuid);
|
||||
//(attachedElement as NoteElement).noteJudgeSubmodule = new NoteJudgeSubmodule(attachedElement);
|
||||
}
|
||||
|
||||
public override void DuplicateBM(BaseElement attached)
|
||||
public override void DuplicateBM(GameElement attached)
|
||||
{
|
||||
//(attached as NoteElement).noteJudgeSubmodule = new NoteJudgeSubmodule(attached);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public abstract partial class NoteBase : BaseElement
|
||||
public abstract partial class NoteBase : GameElement, IHaveTransformSubmodule, IHaveTimeDurationSubmodule, IHaveEffectSubmodule
|
||||
{
|
||||
[Title("Basic Info")]
|
||||
public float exactJudgeTime;
|
||||
@@ -20,39 +20,16 @@ namespace Ichni.RhythmGame
|
||||
[Title("NoteVisual")]
|
||||
public NoteVisualBase noteVisual;
|
||||
|
||||
[Title("NoteEffect")]
|
||||
[Tooltip("生成Note时的特效")]
|
||||
public EffectSubmodule generateEffects;
|
||||
[Tooltip("Note被判定时的特效,不包括Miss")]
|
||||
public EffectSubmodule generalJudgeEffects;
|
||||
[Tooltip("Note被Perfect判定时的特效")]
|
||||
public EffectSubmodule perfectJudgeEffects;
|
||||
[Tooltip("Note被Good判定时的特效")]
|
||||
public EffectSubmodule goodJudgeEffects;
|
||||
[Tooltip("Note被Bad判定时的特效")]
|
||||
public EffectSubmodule badJudgeEffects;
|
||||
[Tooltip("Note未被判定时的特效,即Miss")]
|
||||
public EffectSubmodule missJudgeEffects;
|
||||
|
||||
[Title("Judge Info")]
|
||||
public NoteJudgeSubmodule noteJudgeSubmodule;
|
||||
[Title("Submodules")]
|
||||
public TransformSubmodule transformSubmodule { get; set; }
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
public EffectSubmodule effectSubmodule { get; set; }
|
||||
public NoteJudgeSubmodule noteJudgeSubmodule { get; set; }
|
||||
|
||||
[Title("In-Game Info")]
|
||||
public Vector2 noteScreenPosition;
|
||||
public bool isJudged;
|
||||
|
||||
public override void Initialize(string name, Guid id, List<string> tags)
|
||||
{
|
||||
base.Initialize(name, id, tags);
|
||||
generateEffects = new EffectSubmodule(this);
|
||||
generalJudgeEffects = new EffectSubmodule(this);
|
||||
perfectJudgeEffects = new EffectSubmodule(this);
|
||||
goodJudgeEffects = new EffectSubmodule(this);
|
||||
badJudgeEffects = new EffectSubmodule(this);
|
||||
missJudgeEffects = new EffectSubmodule(this);
|
||||
noteJudgeSubmodule = new NoteJudgeSubmodule(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在MovableTrack上更新Note的位置,注意HoldNote需要重写这个方法
|
||||
/// </summary>
|
||||
@@ -78,24 +55,19 @@ namespace Ichni.RhythmGame
|
||||
trackPositioner.SetPercent(1 - percent);
|
||||
}
|
||||
|
||||
public override void AfterInitialize()
|
||||
protected override void SetDefaultSubmodules()
|
||||
{
|
||||
base.AfterInitialize();
|
||||
submoduleList.Add(generateEffects);
|
||||
submoduleList.Add(generalJudgeEffects);
|
||||
submoduleList.Add(perfectJudgeEffects);
|
||||
submoduleList.Add(goodJudgeEffects);
|
||||
submoduleList.Add(badJudgeEffects);
|
||||
submoduleList.Add(missJudgeEffects);
|
||||
transformSubmodule = new TransformSubmodule(this);
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
effectSubmodule = new EffectSubmodule(this, EffectSubmodule.EffectSubmodulePreset.Note);
|
||||
noteJudgeSubmodule = new NoteJudgeSubmodule(this);
|
||||
|
||||
generateEffects.effectList.ForEach(e => e.Recover());
|
||||
generalJudgeEffects.effectList.ForEach(e => e.Recover());
|
||||
perfectJudgeEffects.effectList.ForEach(e => e.Recover());
|
||||
goodJudgeEffects.effectList.ForEach(e => e.Recover());
|
||||
badJudgeEffects.effectList.ForEach(e => e.Recover());
|
||||
missJudgeEffects.effectList.ForEach(e => e.Recover());
|
||||
submoduleList.Add(transformSubmodule);
|
||||
submoduleList.Add(timeDurationSubmodule);
|
||||
submoduleList.Add(effectSubmodule);
|
||||
submoduleList.Add(noteJudgeSubmodule);
|
||||
}
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (isOnTrack)
|
||||
@@ -122,21 +94,22 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
}
|
||||
|
||||
generateEffects.effectList.ForEach(e => e.UpdateEffect());
|
||||
|
||||
effectSubmodule.effectCollection["Generate"].ForEach(e => e.UpdateEffect());
|
||||
effectSubmodule.effectCollection["GeneralJudge"].ForEach(e => e.UpdateEffect());
|
||||
|
||||
switch (EditorManager.instance.currentJudgeType)
|
||||
{
|
||||
case NoteJudgeType.Perfect:
|
||||
perfectJudgeEffects.effectList.ForEach(e => e.UpdateEffect());
|
||||
effectSubmodule.effectCollection["Perfect"].ForEach(e => e.UpdateEffect());
|
||||
break;
|
||||
case NoteJudgeType.Good:
|
||||
goodJudgeEffects.effectList.ForEach(e => e.UpdateEffect());
|
||||
effectSubmodule.effectCollection["Good"].ForEach(e => e.UpdateEffect());
|
||||
break;
|
||||
case NoteJudgeType.Bad:
|
||||
badJudgeEffects.effectList.ForEach(e => e.UpdateEffect());
|
||||
effectSubmodule.effectCollection["Bad"].ForEach(e => e.UpdateEffect());
|
||||
break;
|
||||
case NoteJudgeType.Miss:
|
||||
missJudgeEffects.effectList.ForEach(e => e.UpdateEffect());
|
||||
effectSubmodule.effectCollection["Miss"].ForEach(e => e.UpdateEffect());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -172,4 +145,33 @@ namespace Ichni.RhythmGame
|
||||
Miss
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public abstract class NoteBase_BM : GameElement_BM
|
||||
{
|
||||
public float exactJudgeTime;
|
||||
|
||||
public NoteBase_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public NoteBase_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement, float exactJudgeTime)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.exactJudgeTime = exactJudgeTime;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,32 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class NoteEffectBase : EffectBase
|
||||
public abstract class NoteEffectBase : EffectBase
|
||||
{
|
||||
public NoteBase note;
|
||||
public NoteVisualBase noteVisual;
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public abstract class NoteEffectBase_BM : EffectBase_BM
|
||||
{
|
||||
public Guid attachedNoteID;
|
||||
|
||||
public NoteEffectBase_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public NoteEffectBase_BM(float effectTime, Guid attachedNoteID) : base(effectTime)
|
||||
{
|
||||
this.attachedNoteID = attachedNoteID;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Dreamteck.Splines;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
@@ -10,17 +11,17 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class Stay : NoteBase
|
||||
{
|
||||
public static Stay GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
float exactJudgeTime, BaseElement attach)
|
||||
public static Stay GenerateElement(string elementName, Guid id, List<string> tags, bool isFirstGenerated,
|
||||
GameElement parentElement, float exactJudgeTime)
|
||||
{
|
||||
Stay stay = Instantiate(EditorManager.instance.basePrefabs.tapNote, attach.transform).GetComponent<Stay>();
|
||||
stay.Initialize(elementName, id, tags);
|
||||
Stay stay = Instantiate(EditorManager.instance.basePrefabs.tapNote, parentElement.transform).GetComponent<Stay>();
|
||||
stay.Initialize(elementName, id, tags, isFirstGenerated);
|
||||
stay.exactJudgeTime = exactJudgeTime;
|
||||
stay.transformSubmodule = new TransformSubmodule(stay);
|
||||
stay.timeDurationSubmodule = new TimeDurationSubmodule(stay);
|
||||
stay.SetParent(attach);
|
||||
stay.SetParent(parentElement);
|
||||
|
||||
if (attach.TryGetComponent(out Track track))
|
||||
if (parentElement.TryGetComponent(out Track track))
|
||||
{
|
||||
if (track.trackTimeSubmodule != null)
|
||||
{
|
||||
@@ -49,35 +50,33 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.Stay_BM(elementName, elementGuid, tags, parentElement.matchedBM, exactJudgeTime);
|
||||
matchedBM = new Stay_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM, exactJudgeTime);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class Stay_BM : BaseElement_BM
|
||||
public class Stay_BM : NoteBase_BM
|
||||
{
|
||||
public float exactJudgeTime;
|
||||
|
||||
public Stay_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Stay_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM attachedElement, float exactJudgeTime)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
public Stay_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement, float exactJudgeTime)
|
||||
: base(elementName, elementGuid, tags, attachedElement, exactJudgeTime)
|
||||
{
|
||||
this.exactJudgeTime = exactJudgeTime;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = Stay.GenerateElement(elementName, elementGuid, tags, exactJudgeTime, GetElement(attachedElementGuid));
|
||||
matchedElement = Stay.GenerateElement(elementName, elementGuid, tags, false, GetElement(attachedElementGuid), exactJudgeTime);
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return Stay.GenerateElement(elementName, elementGuid, tags, exactJudgeTime, parent);
|
||||
return Stay.GenerateElement(elementName, elementGuid, tags, false, parent, exactJudgeTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Dreamteck.Splines;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
@@ -10,17 +11,18 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class Tap : NoteBase
|
||||
{
|
||||
public static Tap GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
float exactJudgeTime, BaseElement attach)
|
||||
public static Tap GenerateElement(string elementName, Guid id, List<string> tags, bool isFirstGenerated,
|
||||
GameElement parentElement, float exactJudgeTime)
|
||||
{
|
||||
Tap tap = Instantiate(EditorManager.instance.basePrefabs.tapNote, attach.transform).GetComponent<Tap>();
|
||||
tap.Initialize(elementName, id, tags);
|
||||
Tap tap = Instantiate(EditorManager.instance.basePrefabs.tapNote, parentElement.transform)
|
||||
.GetComponent<Tap>();
|
||||
tap.Initialize(elementName, id, tags, isFirstGenerated);
|
||||
tap.exactJudgeTime = exactJudgeTime;
|
||||
tap.transformSubmodule = new TransformSubmodule(tap);
|
||||
tap.timeDurationSubmodule = new TimeDurationSubmodule(tap);
|
||||
tap.SetParent(attach);
|
||||
|
||||
if (attach.TryGetComponent(out Track track))
|
||||
tap.SetParent(parentElement);
|
||||
|
||||
if (parentElement.TryGetComponent(out Track track))
|
||||
{
|
||||
if (track.trackTimeSubmodule != null)
|
||||
{
|
||||
@@ -44,40 +46,40 @@ namespace Ichni.RhythmGame
|
||||
return tap;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public partial class Tap
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.Tap_BM(elementName, elementGuid, tags, parentElement.matchedBM, exactJudgeTime);
|
||||
matchedBM = new Tap_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM, exactJudgeTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class Tap_BM : BaseElement_BM
|
||||
public class Tap_BM : NoteBase_BM
|
||||
{
|
||||
public float exactJudgeTime;
|
||||
|
||||
public Tap_BM()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Tap_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM attachedElement, float exactJudgeTime)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
public Tap_BM(string elementName, Guid elementGuid, List<string> tags,
|
||||
GameElement_BM attachedElement, float exactJudgeTime)
|
||||
: base(elementName, elementGuid, tags, attachedElement, exactJudgeTime)
|
||||
{
|
||||
this.exactJudgeTime = exactJudgeTime;
|
||||
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = Tap.GenerateElement(elementName, elementGuid, tags, exactJudgeTime, GetElement(attachedElementGuid));
|
||||
matchedElement = Tap.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid), exactJudgeTime);
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return Tap.GenerateElement(elementName, elementGuid, tags, exactJudgeTime, parent);
|
||||
return Tap.GenerateElement(elementName, elementGuid, tags, false, parent, exactJudgeTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,24 +6,66 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public abstract class SubstantialObject : BaseElement
|
||||
public abstract class SubstantialObject : GameElement, IHaveTransformSubmodule, IHaveTimeDurationSubmodule, IHaveColorSubmodule
|
||||
{
|
||||
public string themeBundleName, objectName;
|
||||
|
||||
public TransformSubmodule transformSubmodule { get; set; }
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
public ColorSubmodule colorSubmodule { get; set; }
|
||||
|
||||
public static SubstantialObject GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
string themeBundleName, string objectName, Vector3 position, Vector3 eulerAngles, Vector3 scale,
|
||||
BaseElement parent, bool isFirstGenerated = true)
|
||||
public static SubstantialObject GenerateElement(string elementName, Guid id, List<string> tags, bool isFirstGenerated,
|
||||
string themeBundleName, string objectName, GameElement parent)
|
||||
{
|
||||
GameObject themeBundleObject = ThemeBundleManager.instance.GetObject<GameObject>(themeBundleName, objectName);
|
||||
SubstantialObject substantialObject = Instantiate(themeBundleObject, parent.transform).GetComponent<SubstantialObject>();
|
||||
substantialObject.Initialize(elementName, id, tags);
|
||||
|
||||
substantialObject.transformSubmodule = new TransformSubmodule(substantialObject, position, eulerAngles, scale);
|
||||
substantialObject.timeDurationSubmodule = new TimeDurationSubmodule(substantialObject);
|
||||
substantialObject.colorSubmodule = new ColorSubmodule(substantialObject);
|
||||
substantialObject.Initialize(elementName, id, tags, isFirstGenerated);
|
||||
substantialObject.SetParent(parent);
|
||||
|
||||
return substantialObject;
|
||||
}
|
||||
|
||||
protected override void SetDefaultSubmodules()
|
||||
{
|
||||
transformSubmodule = new TransformSubmodule(this);
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
colorSubmodule = new ColorSubmodule(this);
|
||||
|
||||
submoduleList.Add(transformSubmodule);
|
||||
submoduleList.Add(timeDurationSubmodule);
|
||||
submoduleList.Add(colorSubmodule);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class SubstantialObject_BM : GameElement_BM
|
||||
{
|
||||
public string themeBundleName;
|
||||
public string objectName;
|
||||
|
||||
public SubstantialObject_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public SubstantialObject_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,
|
||||
string themeBundleName, string objectName)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.themeBundleName = themeBundleName;
|
||||
this.objectName = objectName;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override GameElement DuplicateBM(GameElement attached)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,45 +3,58 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Dreamteck.Splines;
|
||||
using Ichni;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class PathNode : BaseElement
|
||||
public partial class PathNode : GameElement, IHaveTransformSubmodule, IHaveTimeDurationSubmodule,
|
||||
IHaveColorSubmodule
|
||||
{
|
||||
public ColorSubmodule colorSubmodule;
|
||||
|
||||
public Track track;
|
||||
|
||||
public int index => track.trackPathSubmodule.pathNodeList.IndexOf(this);
|
||||
|
||||
public SplinePoint node;
|
||||
|
||||
public static PathNode GenerateElement(string elementName, Guid id, List<string> tags, Track track)
|
||||
public TransformSubmodule transformSubmodule { get; set; }
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
public ColorSubmodule colorSubmodule { get; set; }
|
||||
|
||||
public static PathNode GenerateElement(string elementName, Guid id, List<string> tags, bool isFirstGenerated,
|
||||
Track track)
|
||||
{
|
||||
PathNode pathNode = Instantiate(EditorManager.instance.basePrefabs.pathNode, track.transform)
|
||||
.GetComponent<PathNode>();
|
||||
|
||||
pathNode.Initialize(elementName, id, tags);
|
||||
pathNode.Initialize(elementName, id, tags, isFirstGenerated);
|
||||
|
||||
pathNode.track = track;
|
||||
//pathNode.index = index;
|
||||
|
||||
pathNode.transformSubmodule = new TransformSubmodule(pathNode);
|
||||
pathNode.timeDurationSubmodule = new TimeDurationSubmodule(pathNode);
|
||||
pathNode.colorSubmodule = new ColorSubmodule(pathNode);
|
||||
|
||||
track.trackPathSubmodule.pathNodeList.Add(pathNode);
|
||||
|
||||
pathNode.SetParent(track);
|
||||
|
||||
return pathNode;
|
||||
}
|
||||
|
||||
protected override void SetDefaultSubmodules()
|
||||
{
|
||||
transformSubmodule = new TransformSubmodule(this);
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
colorSubmodule = new ColorSubmodule(this);
|
||||
|
||||
submoduleList.Add(transformSubmodule);
|
||||
submoduleList.Add(timeDurationSubmodule);
|
||||
submoduleList.Add(colorSubmodule);
|
||||
}
|
||||
|
||||
|
||||
public override void AfterInitialize()
|
||||
{
|
||||
base.AfterInitialize();
|
||||
|
||||
|
||||
Refresh();
|
||||
if (track.trackPathSubmodule.pathNodeList.Count > 3)
|
||||
{
|
||||
@@ -58,7 +71,7 @@ namespace Ichni.RhythmGame
|
||||
Vector3 normal = Quaternion.Euler(transformSubmodule.currentEulerAngles) * Vector3.up;
|
||||
float size = transformSubmodule.currentScale.x;
|
||||
Color color = colorSubmodule.currentBaseColor;
|
||||
|
||||
|
||||
transform.position = position;
|
||||
transform.rotation = Quaternion.LookRotation(normal);
|
||||
transform.localScale = Vector3.one * size;
|
||||
@@ -72,34 +85,34 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.PathNode_BM(elementName, elementGuid, tags, parentElement.matchedBM);
|
||||
matchedBM = new Beatmap.PathNode_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class PathNode_BM : BaseElement_BM
|
||||
public class PathNode_BM : GameElement_BM
|
||||
{
|
||||
public PathNode_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public PathNode_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM attachedElement)
|
||||
public PathNode_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = PathNode.GenerateElement(elementName, elementGuid, tags,
|
||||
matchedElement = PathNode.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid) as Track);
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return PathNode.GenerateElement(elementName, elementGuid, tags, parent as Track);
|
||||
return PathNode.GenerateElement(elementName, elementGuid, tags, false, parent as Track);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,43 +1,40 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class Track : BaseElement
|
||||
public partial class Track : GameElement, IHaveTransformSubmodule, IHaveTimeDurationSubmodule
|
||||
{
|
||||
public TrackPathSubmodule trackPathSubmodule;
|
||||
public TrackTimeSubmodule trackTimeSubmodule;
|
||||
public TrackRendererSubmodule trackRendererSubmodule;
|
||||
|
||||
public static Track GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
BaseElement parent, Vector3 position)
|
||||
public TransformSubmodule transformSubmodule { get; set; }
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
public TrackPathSubmodule trackPathSubmodule { get; set; }
|
||||
public TrackTimeSubmodule trackTimeSubmodule { get; set; }
|
||||
public TrackRendererSubmodule trackRendererSubmodule { get; set; }
|
||||
|
||||
public static Track GenerateElement(string elementName, Guid id, List<string> tags, bool isFirstGenerated, GameElement parent)
|
||||
{
|
||||
Track track = Instantiate(EditorManager.instance.basePrefabs.track, parent.transform).GetComponent<Track>();
|
||||
|
||||
track.Initialize(elementName, id, tags);
|
||||
track.Initialize(elementName, id, tags, isFirstGenerated);
|
||||
track.SetParent(parent);
|
||||
|
||||
track.transformSubmodule = new TransformSubmodule(track, position, Vector3.zero, Vector3.one);
|
||||
track.timeDurationSubmodule = new TimeDurationSubmodule(track);
|
||||
|
||||
track.trackPathSubmodule = null;
|
||||
track.trackTimeSubmodule = null;
|
||||
track.trackRendererSubmodule = null;
|
||||
|
||||
track.SetTransformObserver();
|
||||
|
||||
return track;
|
||||
}
|
||||
|
||||
public override void AfterInitialize()
|
||||
protected override void SetDefaultSubmodules()
|
||||
{
|
||||
base.AfterInitialize();
|
||||
submoduleList.Add(trackPathSubmodule);
|
||||
submoduleList.Add(trackTimeSubmodule);
|
||||
submoduleList.Add(trackRendererSubmodule);
|
||||
transformSubmodule = new TransformSubmodule(this);
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
trackPathSubmodule = null;
|
||||
trackTimeSubmodule = null;
|
||||
trackRendererSubmodule = null;
|
||||
|
||||
submoduleList.Add(transformSubmodule);
|
||||
submoduleList.Add(timeDurationSubmodule);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@@ -53,7 +50,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.Track_BM(elementName, elementGuid, tags, parentElement.matchedBM);
|
||||
matchedBM = new Beatmap.Track_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,14 +72,14 @@ namespace Ichni.RhythmGame
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class Track_BM : BaseElement_BM
|
||||
public class Track_BM : GameElement_BM
|
||||
{
|
||||
public Track_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Track_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM attachedElement)
|
||||
public Track_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
|
||||
@@ -90,12 +87,12 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = Track.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid), Vector3.zero);
|
||||
matchedElement = Track.GenerateElement(elementName, elementGuid, tags, false, GetElement(attachedElementGuid));
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return Track.GenerateElement(elementName, elementGuid, tags, parent, Vector3.zero);
|
||||
return Track.GenerateElement(elementName, elementGuid, tags, false, parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,12 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Dreamteck.Splines;
|
||||
using Ichni.RhythmGame;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class CrossTrackPoint : BaseElement
|
||||
public partial class CrossTrackPoint : GameElement, IHaveTimeDurationSubmodule
|
||||
{
|
||||
public ElementFolder trackListFolder;
|
||||
public Track nowAttachedTrack;
|
||||
@@ -16,24 +17,32 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public FlexibleInt trackSwitch;
|
||||
public FlexibleFloat trackPercent;
|
||||
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
|
||||
public static CrossTrackPoint GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
bool isFirstGenerated,
|
||||
ElementFolder elementFolder, FlexibleInt trackSwitch, FlexibleFloat trackPercent)
|
||||
{
|
||||
CrossTrackPoint point = Instantiate(EditorManager.instance.basePrefabs.emptyObject, elementFolder.transform).AddComponent<CrossTrackPoint>();
|
||||
point.Initialize(elementName, id, tags);
|
||||
CrossTrackPoint point = Instantiate(EditorManager.instance.basePrefabs.emptyObject, elementFolder.transform)
|
||||
.AddComponent<CrossTrackPoint>();
|
||||
point.Initialize(elementName, id, tags, isFirstGenerated);
|
||||
point.trackPositioner = point.gameObject.AddComponent<SplinePositioner>();
|
||||
point.nowAttachedTrackIndex = -1;
|
||||
point.trackListFolder = elementFolder;
|
||||
point.trackSwitch = trackSwitch;
|
||||
point.trackPercent = trackPercent;
|
||||
point.transformSubmodule = new TransformSubmodule(point);
|
||||
point.timeDurationSubmodule = new TimeDurationSubmodule(point);
|
||||
point.SetParent(elementFolder);
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
protected override void SetDefaultSubmodules()
|
||||
{
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
submoduleList.Add(timeDurationSubmodule);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (trackPercent.animations.Count > 0)
|
||||
@@ -46,7 +55,8 @@ namespace Ichni.RhythmGame
|
||||
|
||||
private void SetPoint()
|
||||
{
|
||||
if (nowAttachedTrackIndex != trackSwitch.value && trackSwitch.value >= 0 && trackSwitch.value < trackListFolder.trackList.Count)
|
||||
if (nowAttachedTrackIndex != trackSwitch.value && trackSwitch.value >= 0 &&
|
||||
trackSwitch.value < trackListFolder.trackList.Count)
|
||||
{
|
||||
nowAttachedTrack = trackListFolder.trackList[trackSwitch.value];
|
||||
nowAttachedTrackIndex = trackSwitch.value;
|
||||
@@ -56,28 +66,30 @@ namespace Ichni.RhythmGame
|
||||
trackPositioner.SetPercent(trackPercent.value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public partial class CrossTrackPoint
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.CrossTrackPoint_BM(elementName, elementGuid, tags, parentElement.matchedBM, trackSwitch, trackPercent);
|
||||
matchedBM = new CrossTrackPoint_BM(elementName, elementGuid, tags,
|
||||
parentElement.matchedBM as GameElement_BM, trackSwitch, trackPercent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class CrossTrackPoint_BM : BaseElement_BM
|
||||
public class CrossTrackPoint_BM : GameElement_BM
|
||||
{
|
||||
public FlexibleInt trackSwitch;
|
||||
public FlexibleFloat trackPercent;
|
||||
|
||||
public CrossTrackPoint_BM()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public CrossTrackPoint_BM(string elementName, Guid elementGuid, List<string> tags,
|
||||
BaseElement_BM attachedElement, FlexibleInt trackSwitch, FlexibleFloat trackPercent)
|
||||
GameElement_BM attachedElement, FlexibleInt trackSwitch, FlexibleFloat trackPercent)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.trackSwitch = trackSwitch;
|
||||
@@ -86,14 +98,14 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
CrossTrackPoint.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid) as ElementFolder,
|
||||
trackSwitch, trackPercent);
|
||||
CrossTrackPoint.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid) as ElementFolder, trackSwitch, trackPercent);
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return CrossTrackPoint.GenerateElement(elementName, elementGuid, tags, parent as ElementFolder,
|
||||
trackSwitch, trackPercent);
|
||||
return CrossTrackPoint.GenerateElement(elementName, elementGuid, tags, false,
|
||||
parent as ElementFolder, trackSwitch, trackPercent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,23 +2,27 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Dreamteck.Splines;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class TrackHeadPoint : BaseElement
|
||||
public partial class TrackHeadPoint : GameElement, IHaveTimeDurationSubmodule
|
||||
{
|
||||
public Track track;
|
||||
public TrackTimeSubmoduleMovable trackTimeSubmoduleMovable;
|
||||
public SplinePositioner trackPositioner;
|
||||
|
||||
public static TrackHeadPoint GenerateElement(string elementName, Guid id, List<string> tags, Track track)
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
|
||||
public static TrackHeadPoint GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
bool isFirstGenerated, Track track)
|
||||
{
|
||||
TrackHeadPoint head = Instantiate(EditorManager.instance.basePrefabs.emptyObject, track.transform)
|
||||
.AddComponent<TrackHeadPoint>();
|
||||
|
||||
head.Initialize(elementName, id, tags);
|
||||
head.Initialize(elementName, id, tags, isFirstGenerated);
|
||||
head.track = track;
|
||||
head.trackPositioner = head.gameObject.AddComponent<SplinePositioner>();
|
||||
head.trackPositioner.spline = track.trackPathSubmodule.path;
|
||||
@@ -27,6 +31,12 @@ namespace Ichni.RhythmGame
|
||||
return head;
|
||||
}
|
||||
|
||||
protected override void SetDefaultSubmodules()
|
||||
{
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
submoduleList.Add(timeDurationSubmodule);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (track.timeDurationSubmodule.CheckTimeInDuration(EditorManager.instance.songModule.songTime))
|
||||
@@ -40,13 +50,13 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.TrackHeadPoint_BM(elementName, elementGuid, tags, parentElement.matchedBM);
|
||||
matchedBM = new TrackHeadPoint_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class TrackHeadPoint_BM : BaseElement_BM
|
||||
public class TrackHeadPoint_BM : GameElement_BM
|
||||
{
|
||||
public TrackHeadPoint_BM()
|
||||
{
|
||||
@@ -54,20 +64,20 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
|
||||
public TrackHeadPoint_BM(string elementName, Guid elementGuid, List<string> tags,
|
||||
BaseElement_BM attachedElement)
|
||||
GameElement_BM attachedElement)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
TrackHeadPoint.GenerateElement(elementName, elementGuid, tags,
|
||||
TrackHeadPoint.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid) as Track);
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return TrackHeadPoint.GenerateElement(elementName, elementGuid, tags, parent as Track);
|
||||
return TrackHeadPoint.GenerateElement(elementName, elementGuid, tags, false, parent as Track);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Dreamteck.Splines;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
@@ -12,31 +13,41 @@ namespace Ichni.RhythmGame
|
||||
/// <summary>
|
||||
/// 在轨道上根据百分比进行运动的点
|
||||
/// </summary>
|
||||
public partial class TrackPercentPoint : BaseElement
|
||||
public partial class TrackPercentPoint : GameElement, IHaveTimeDurationSubmodule
|
||||
{
|
||||
public Track track;
|
||||
public SplinePositioner trackPositioner;
|
||||
public FlexibleFloat trackPercent;
|
||||
|
||||
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
|
||||
private bool isBeyond1 = false;
|
||||
|
||||
public static TrackPercentPoint GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
bool isFirstGenerated,
|
||||
Track track, FlexibleFloat trackPercent)
|
||||
{
|
||||
TrackPercentPoint point = Instantiate(EditorManager.instance.basePrefabs.emptyObject, track.transform).AddComponent<TrackPercentPoint>();
|
||||
TrackPercentPoint point = Instantiate(EditorManager.instance.basePrefabs.emptyObject, track.transform)
|
||||
.AddComponent<TrackPercentPoint>();
|
||||
|
||||
point.Initialize(elementName, id, tags);
|
||||
point.Initialize(elementName, id, tags, isFirstGenerated);
|
||||
point.track = track;
|
||||
point.trackPositioner = point.gameObject.AddComponent<SplinePositioner>();
|
||||
point.trackPositioner.spline = track.trackPathSubmodule.path;
|
||||
point.trackPercent = trackPercent;
|
||||
point.SetParent(track);
|
||||
|
||||
point.isBeyond1 = trackPercent.animations.Any(animation => animation.endValue > 1);//判断是否有超过1的动画,超过1将会循环
|
||||
point.isBeyond1 = trackPercent.animations.Any(animation => animation.endValue > 1); //判断是否有超过1的动画,超过1将会循环
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
protected override void SetDefaultSubmodules()
|
||||
{
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
submoduleList.Add(timeDurationSubmodule);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (trackPercent.animations.Count > 0)
|
||||
@@ -45,38 +56,41 @@ namespace Ichni.RhythmGame
|
||||
if (trackPercent.returnType == FlexibleReturnType.MiddleExecuting)
|
||||
{
|
||||
float finalValue = trackPercent.value;
|
||||
|
||||
|
||||
if (isBeyond1)
|
||||
{
|
||||
finalValue -= Mathf.Floor(finalValue);
|
||||
}
|
||||
|
||||
|
||||
trackPositioner.SetPercent(finalValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public partial class TrackPercentPoint
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.TrackPercentPoint_BM(elementName, elementGuid, tags, parentElement.matchedBM, trackPercent.ConvertToBM());
|
||||
matchedBM = new TrackPercentPoint_BM(elementName, elementGuid, tags,
|
||||
parentElement.matchedBM as GameElement_BM,
|
||||
trackPercent.ConvertToBM());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class TrackPercentPoint_BM : BaseElement_BM
|
||||
public class TrackPercentPoint_BM : GameElement_BM
|
||||
{
|
||||
public FlexibleFloat_BM trackPercent;
|
||||
|
||||
public TrackPercentPoint_BM()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public TrackPercentPoint_BM(string elementName, Guid elementGuid, List<string> tags,
|
||||
BaseElement_BM attachedElement, FlexibleFloat_BM trackPercent)
|
||||
GameElement_BM attachedElement, FlexibleFloat_BM trackPercent)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.trackPercent = trackPercent;
|
||||
@@ -84,12 +98,14 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
TrackPercentPoint.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid) as Track, trackPercent.ConvertToGameType());
|
||||
TrackPercentPoint.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid) as Track, trackPercent.ConvertToGameType());
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return TrackPercentPoint.GenerateElement(elementName, elementGuid, tags, parent as Track, trackPercent.ConvertToGameType());
|
||||
return TrackPercentPoint.GenerateElement(elementName, elementGuid, tags, false, parent as Track,
|
||||
trackPercent.ConvertToGameType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
override public void SaveBM()
|
||||
{
|
||||
matchedBM = new TrackPathSubmodule_BM(attachedElement, this);
|
||||
matchedBM = new TrackPathSubmodule_BM(attachedGameElement, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
|
||||
|
||||
public TrackPathSubmodule_BM(BaseElement attachedElement, TrackPathSubmodule trackPathSubmodule) : base(
|
||||
public TrackPathSubmodule_BM(GameElement attachedElement, TrackPathSubmodule trackPathSubmodule) : base(
|
||||
attachedElement)
|
||||
{
|
||||
this.trackSpaceType = trackPathSubmodule.trackSpaceType;
|
||||
@@ -97,13 +97,15 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
attachedElement = GetElement(attachedElementGuid);
|
||||
(attachedElement as Track).trackPathSubmodule = new TrackPathSubmodule(attachedElement as Track, trackSpaceType, trackSamplingType, isClosed);
|
||||
attachedElement = GameElement_BM.GetElement(attachedElementGuid);
|
||||
Track track = attachedElement as Track;
|
||||
track.trackPathSubmodule = new TrackPathSubmodule(track, trackSpaceType, trackSamplingType, isClosed);
|
||||
}
|
||||
|
||||
public override void DuplicateBM(BaseElement attached)
|
||||
public override void DuplicateBM(GameElement attached)
|
||||
{
|
||||
(attached as Track).trackPathSubmodule = new TrackPathSubmodule(attached as Track, trackSpaceType, trackSamplingType, isClosed);
|
||||
Track track = attachedElement as Track;
|
||||
track.trackPathSubmodule = new TrackPathSubmodule(track, trackSpaceType, trackSamplingType, isClosed);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.TrackRendererSubmoduleAutoOrient_BM(attachedElement, this);
|
||||
matchedBM = new Beatmap.TrackRendererSubmoduleAutoOrient_BM(attachedGameElement, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
}
|
||||
|
||||
public TrackRendererSubmoduleAutoOrient_BM(BaseElement attachedElement,
|
||||
public TrackRendererSubmoduleAutoOrient_BM(GameElement attachedElement,
|
||||
TrackRendererSubmodule trackRendererSubmodule) : base(attachedElement)
|
||||
{
|
||||
renderMaterialName = trackRendererSubmodule.renderMaterial.name;
|
||||
@@ -75,14 +75,15 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
attachedElement = GetElement(attachedElementGuid);
|
||||
(attachedElement as Track).trackRendererSubmodule =
|
||||
new TrackRendererSubmodule(attachedElement as Track);
|
||||
attachedElement = GameElement_BM.GetElement(attachedElementGuid);
|
||||
Track track = attachedElement as Track;
|
||||
track.trackRendererSubmodule = new TrackRendererSubmodule(track);//TODO: Implement Material
|
||||
}
|
||||
|
||||
public override void DuplicateBM(BaseElement attached)
|
||||
public override void DuplicateBM(GameElement attached)
|
||||
{
|
||||
(attached as Track).trackRendererSubmodule = new TrackRendererSubmodule(attached as Track);
|
||||
Track track = attached as Track;
|
||||
track.trackRendererSubmodule = new TrackRendererSubmodule(track);//TODO: Implement Material
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,12 +7,10 @@ namespace Ichni.RhythmGame
|
||||
public abstract class TrackSubmodule : SubmoduleBase
|
||||
{
|
||||
public Track track;
|
||||
public bool isUpdating;
|
||||
|
||||
|
||||
public TrackSubmodule(Track track) : base(track)
|
||||
{
|
||||
this.track = track;
|
||||
isUpdating = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.TrackTimeSubmoduleMovable_BM(attachedElement, this);
|
||||
matchedBM = new Beatmap.TrackTimeSubmoduleMovable_BM(attachedGameElement, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
}
|
||||
|
||||
public TrackTimeSubmoduleMovable_BM(BaseElement attachedElement, TrackTimeSubmoduleMovable trackTimeSubmoduleMovable) : base(attachedElement)
|
||||
public TrackTimeSubmoduleMovable_BM(GameElement attachedElement, TrackTimeSubmoduleMovable trackTimeSubmoduleMovable) : base(attachedElement)
|
||||
{
|
||||
trackStartTime = trackTimeSubmoduleMovable.trackStartTime;
|
||||
trackEndTime = trackTimeSubmoduleMovable.trackEndTime;
|
||||
@@ -95,12 +95,12 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
attachedElement = GetElement(attachedElementGuid);
|
||||
attachedElement = GameElement_BM.GetElement(attachedElementGuid);
|
||||
Track track = attachedElement as Track;
|
||||
track.trackTimeSubmodule = new TrackTimeSubmoduleMovable(track, trackStartTime, trackEndTime, visibleTrackTimeLength, animationCurveType);
|
||||
}
|
||||
|
||||
public override void DuplicateBM(BaseElement attached)
|
||||
public override void DuplicateBM(GameElement attached)
|
||||
{
|
||||
Track track = attached as Track;
|
||||
track.trackTimeSubmodule = new TrackTimeSubmoduleMovable(track, trackStartTime, trackEndTime, visibleTrackTimeLength, animationCurveType);
|
||||
@@ -131,7 +131,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.TrackTimeSubmoduleStatic_BM(attachedElement, this);
|
||||
matchedBM = new Beatmap.TrackTimeSubmoduleStatic_BM(attachedGameElement, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
}
|
||||
|
||||
public TrackTimeSubmoduleStatic_BM(BaseElement attachedElement, TrackTimeSubmoduleStatic trackTimeSubmoduleStatic) : base(attachedElement)
|
||||
public TrackTimeSubmoduleStatic_BM(GameElement attachedElement, TrackTimeSubmoduleStatic trackTimeSubmoduleStatic) : base(attachedElement)
|
||||
{
|
||||
trackTotalTime = trackTimeSubmoduleStatic.trackTotalTime;
|
||||
animationCurveType = trackTimeSubmoduleStatic.animationCurveType;
|
||||
@@ -155,12 +155,12 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
attachedElement = GetElement(attachedElementGuid);
|
||||
attachedElement = GameElement_BM.GetElement(attachedElementGuid);
|
||||
Track track = attachedElement as Track;
|
||||
track.trackTimeSubmodule = new TrackTimeSubmoduleStatic(track, trackTotalTime, animationCurveType);
|
||||
}
|
||||
|
||||
public override void DuplicateBM(BaseElement attached)
|
||||
public override void DuplicateBM(GameElement attached)
|
||||
{
|
||||
Track track = attached as Track;
|
||||
track.trackTimeSubmodule = new TrackTimeSubmoduleStatic(track, trackTotalTime, animationCurveType);
|
||||
|
||||
@@ -1,74 +1,83 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class Trail : BaseElement
|
||||
public partial class Trail : GameElement, IHaveTransformSubmodule
|
||||
{
|
||||
public TrailRenderer trailRenderer;
|
||||
public Material renderMaterial;
|
||||
|
||||
public float visibleTimeLength;
|
||||
|
||||
public static Trail GenerateElement(string name, Guid id, List<string> tags,
|
||||
BaseElement parentElement, float visibleTimeLength, Material material = null)
|
||||
public TransformSubmodule transformSubmodule { get; set; }
|
||||
|
||||
public static Trail GenerateElement(string name, Guid id, List<string> tags, bool isFirstGenerated,
|
||||
GameElement parentElement, float visibleTimeLength, Material material = null)
|
||||
{
|
||||
Trail trail = Instantiate(EditorManager.instance.basePrefabs.trail).GetComponent<Trail>();
|
||||
trail.trailRenderer = trail.GetComponent<TrailRenderer>();
|
||||
|
||||
trail.Initialize(name, id, tags);
|
||||
trail.Initialize(name, id, tags, isFirstGenerated);
|
||||
trail.renderMaterial =
|
||||
material == null ? EditorManager.instance.basePrefabs.defaultTrailMaterial : material;
|
||||
trail.trailRenderer.material = trail.renderMaterial;
|
||||
trail.visibleTimeLength = visibleTimeLength;
|
||||
trail.SetParent(parentElement);
|
||||
|
||||
trail.transformSubmodule = new TransformSubmodule(trail);
|
||||
|
||||
return trail;
|
||||
}
|
||||
|
||||
protected override void SetDefaultSubmodules()
|
||||
{
|
||||
transformSubmodule = new TransformSubmodule(this);
|
||||
submoduleList.Add(transformSubmodule);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Trail
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.Trail_BM(elementName, elementGuid, tags, parentElement.matchedBM, visibleTimeLength,
|
||||
renderMaterial);
|
||||
matchedBM = new Trail_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
|
||||
visibleTimeLength, renderMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class Trail_BM : BaseElement_BM
|
||||
public class Trail_BM : GameElement_BM
|
||||
{
|
||||
public float visibleTimeLength;
|
||||
public Material renderMaterial;
|
||||
public string renderMaterialName;
|
||||
|
||||
public Trail_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Trail_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM attachedElement,
|
||||
float visibleTimeLength, Material renderMaterial)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
public Trail_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,
|
||||
float visibleTimeLength, Material renderMaterial) : base(elementName, elementGuid, tags,
|
||||
attachedElement)
|
||||
{
|
||||
this.visibleTimeLength = visibleTimeLength;
|
||||
this.renderMaterial = renderMaterial;
|
||||
this.renderMaterialName = renderMaterial.name;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = Trail.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid),
|
||||
visibleTimeLength, renderMaterial);
|
||||
matchedElement = Trail.GenerateElement(elementName, elementGuid, tags,
|
||||
false, GetElement(attachedElementGuid),
|
||||
visibleTimeLength); //TODO: Implement Material
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return Trail.GenerateElement(elementName, elementGuid, tags, parent, visibleTimeLength, renderMaterial);
|
||||
return Trail.GenerateElement(elementName, elementGuid, tags,
|
||||
false, parent, visibleTimeLength); //TODO: Implement Material
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user