架构重新设计
基本重做了所有物体和次级模块代码
This commit is contained in:
@@ -4,23 +4,25 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public abstract class AnimationBase : BaseElement
|
||||
public abstract class AnimationBase : GameElement, IHaveTimeDurationSubmodule
|
||||
{
|
||||
public BaseElement targetObject;
|
||||
public GameElement animatedObject;
|
||||
public FlexibleReturnType animationReturnType;
|
||||
//public ICanHaveAnimation target;
|
||||
|
||||
public override void Initialize(string elementName, Guid id, List<string> tags)
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
|
||||
protected override void SetDefaultSubmodules()
|
||||
{
|
||||
base.Initialize(elementName, id, tags);
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
submoduleList.Add(timeDurationSubmodule);
|
||||
}
|
||||
|
||||
protected abstract void UpdateAnimation(float songTime);
|
||||
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
if (timeDurationSubmodule.CheckTimeInDuration(EditorManager.instance.songModule.songTime))
|
||||
@@ -29,4 +31,22 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public abstract class AnimationBase_BM : GameElement_BM
|
||||
{
|
||||
public AnimationBase_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public AnimationBase_BM(string elementName, Guid elementGuid, List<string> tags,
|
||||
GameElement_BM attachedElement) : base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,18 +9,18 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class BaseColorChange : AnimationBase
|
||||
{
|
||||
public ColorSubmodule targetColorSubmodule;
|
||||
private ColorSubmodule targetColorSubmodule;
|
||||
public FlexibleFloat colorR, colorG, colorB, colorA;
|
||||
|
||||
public static BaseColorChange GenerateElement(string elementName, Guid id,
|
||||
List<string> tags, BaseElement targetObject,
|
||||
List<string> tags, bool isFirstGenerated, GameElement animatedObject,
|
||||
FlexibleFloat colorR, FlexibleFloat colorG, FlexibleFloat colorB, FlexibleFloat colorA)
|
||||
{
|
||||
BaseColorChange baseColorChange = Instantiate(EditorManager.instance.basePrefabs.emptyObject)
|
||||
.AddComponent<BaseColorChange>();
|
||||
|
||||
baseColorChange.Initialize(elementName, id, tags);
|
||||
baseColorChange.targetObject = targetObject;
|
||||
baseColorChange.Initialize(elementName, id, tags, isFirstGenerated);
|
||||
baseColorChange.animatedObject = animatedObject;
|
||||
|
||||
baseColorChange.colorR = colorR;
|
||||
baseColorChange.colorG = colorG;
|
||||
@@ -28,21 +28,20 @@ namespace Ichni.RhythmGame
|
||||
baseColorChange.colorA = colorA;
|
||||
baseColorChange.animationReturnType = FlexibleReturnType.Before;
|
||||
|
||||
if (targetObject.colorSubmodule != null)
|
||||
{
|
||||
baseColorChange.targetColorSubmodule = targetObject.colorSubmodule;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new System.Exception("Target object does not have a ColorSubmodule");
|
||||
}
|
||||
baseColorChange.targetColorSubmodule = (animatedObject as IHaveColorSubmodule).colorSubmodule;
|
||||
|
||||
baseColorChange.SetParent(targetObject);
|
||||
baseColorChange.timeDurationSubmodule.SetDuration(colorR, colorG, colorB, colorA);
|
||||
baseColorChange.SetParent(animatedObject);
|
||||
//baseColorChange.timeDurationSubmodule.SetDuration(colorR, colorG, colorB, colorA);
|
||||
|
||||
return baseColorChange;
|
||||
}
|
||||
|
||||
protected override void SetDefaultSubmodules()
|
||||
{
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
submoduleList.Add(timeDurationSubmodule);
|
||||
}
|
||||
|
||||
protected override void UpdateAnimation(float songTime)
|
||||
{
|
||||
colorR.UpdateFlexibleFloat(songTime);
|
||||
@@ -71,14 +70,15 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new BaseColorChange_BM(elementName, elementGuid, tags, targetObject.matchedBM as BaseElement_BM,
|
||||
colorR.ConvertToBM(), colorG.ConvertToBM(), colorB.ConvertToBM(), colorA.ConvertToBM());
|
||||
matchedBM = new BaseColorChange_BM(elementName, elementGuid, tags,
|
||||
animatedObject.matchedBM as GameElement_BM, colorR.ConvertToBM(),
|
||||
colorG.ConvertToBM(), colorB.ConvertToBM(), colorA.ConvertToBM());
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class BaseColorChange_BM : BaseElement_BM
|
||||
public class BaseColorChange_BM : AnimationBase_BM
|
||||
{
|
||||
public FlexibleFloat_BM colorR, colorG, colorB, colorA;
|
||||
|
||||
@@ -88,9 +88,9 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
|
||||
public BaseColorChange_BM(string elementName, Guid elementGuid, List<string> tags,
|
||||
BaseElement_BM attachedElement, FlexibleFloat_BM colorR, FlexibleFloat_BM colorG,
|
||||
FlexibleFloat_BM colorB, FlexibleFloat_BM colorA) : base(elementName, elementGuid, tags,
|
||||
attachedElement)
|
||||
GameElement_BM attachedElement, FlexibleFloat_BM colorR, FlexibleFloat_BM colorG,
|
||||
FlexibleFloat_BM colorB, FlexibleFloat_BM colorA) :
|
||||
base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.colorR = colorR;
|
||||
this.colorG = colorG;
|
||||
@@ -100,16 +100,16 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
BaseColorChange.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid),
|
||||
colorR.ConvertToGameType(), colorG.ConvertToGameType(), colorB.ConvertToGameType(),
|
||||
colorA.ConvertToGameType());
|
||||
BaseColorChange.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid), colorR.ConvertToGameType(),
|
||||
colorG.ConvertToGameType(), colorB.ConvertToGameType(), colorA.ConvertToGameType());
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return BaseColorChange.GenerateElement(elementName, elementGuid, tags, parent,
|
||||
colorR.ConvertToGameType(), colorG.ConvertToGameType(), colorB.ConvertToGameType(),
|
||||
colorA.ConvertToGameType());
|
||||
return BaseColorChange.GenerateElement(elementName, elementGuid, tags, false,
|
||||
parent, colorR.ConvertToGameType(), colorG.ConvertToGameType(),
|
||||
colorB.ConvertToGameType(), colorA.ConvertToGameType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,17 +9,17 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class EmissionColorChange : AnimationBase
|
||||
{
|
||||
public ColorSubmodule targetColorSubmodule;
|
||||
private ColorSubmodule targetColorSubmodule;
|
||||
public FlexibleFloat colorR, colorG, colorB, colorI;
|
||||
|
||||
public static EmissionColorChange GenerateElement(string elementName, Guid id,
|
||||
List<string> tags, BaseElement targetObject,
|
||||
List<string> tags, bool isFirstGenerated, GameElement animatedObject,
|
||||
FlexibleFloat colorR, FlexibleFloat colorG, FlexibleFloat colorB, FlexibleFloat colorI)
|
||||
{
|
||||
EmissionColorChange emissionColorChange = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent<EmissionColorChange>();
|
||||
|
||||
emissionColorChange.Initialize(elementName, id, tags);
|
||||
emissionColorChange.targetObject = targetObject;
|
||||
emissionColorChange.Initialize(elementName, id, tags, isFirstGenerated);
|
||||
emissionColorChange.animatedObject = animatedObject;
|
||||
|
||||
emissionColorChange.colorR = colorR;
|
||||
emissionColorChange.colorG = colorG;
|
||||
@@ -27,22 +27,21 @@ namespace Ichni.RhythmGame
|
||||
emissionColorChange.colorI = colorI;
|
||||
emissionColorChange.animationReturnType = FlexibleReturnType.Before;
|
||||
|
||||
if (targetObject.colorSubmodule != null)
|
||||
{
|
||||
emissionColorChange.targetColorSubmodule = targetObject.colorSubmodule;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new System.Exception("Target object does not have a ColorSubmodule");
|
||||
}
|
||||
emissionColorChange.targetColorSubmodule = (animatedObject as IHaveColorSubmodule).colorSubmodule;
|
||||
|
||||
emissionColorChange.SetParent(animatedObject);
|
||||
|
||||
emissionColorChange.SetParent(targetObject);
|
||||
|
||||
emissionColorChange.timeDurationSubmodule.SetDuration(colorR, colorG, colorB, colorI);
|
||||
//emissionColorChange.timeDurationSubmodule.SetDuration(colorR, colorG, colorB, colorI);
|
||||
|
||||
return emissionColorChange;
|
||||
}
|
||||
|
||||
protected override void SetDefaultSubmodules()
|
||||
{
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
submoduleList.Add(timeDurationSubmodule);
|
||||
}
|
||||
|
||||
protected override void UpdateAnimation(float songTime)
|
||||
{
|
||||
colorR.UpdateFlexibleFloat(songTime);
|
||||
@@ -74,14 +73,14 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new EmissionColorChange_BM(elementName, elementGuid, tags, targetObject.matchedBM,
|
||||
matchedBM = new EmissionColorChange_BM(elementName, elementGuid, tags, animatedObject.matchedBM as GameElement_BM,
|
||||
colorR.ConvertToBM(), colorG.ConvertToBM(), colorB.ConvertToBM(), colorI.ConvertToBM());
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class EmissionColorChange_BM : BaseElement_BM
|
||||
public class EmissionColorChange_BM : AnimationBase_BM
|
||||
{
|
||||
public FlexibleFloat_BM colorR, colorG, colorB, colorI;
|
||||
|
||||
@@ -90,8 +89,9 @@ namespace Ichni.RhythmGame
|
||||
|
||||
}
|
||||
|
||||
public EmissionColorChange_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM parentElement,
|
||||
FlexibleFloat_BM colorR, FlexibleFloat_BM colorG, FlexibleFloat_BM colorB, FlexibleFloat_BM colorI) : base(elementName, elementGuid, tags, parentElement)
|
||||
public EmissionColorChange_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM parentElement,
|
||||
FlexibleFloat_BM colorR, FlexibleFloat_BM colorG, FlexibleFloat_BM colorB, FlexibleFloat_BM colorI) :
|
||||
base(elementName, elementGuid, tags, parentElement)
|
||||
{
|
||||
this.colorR = colorR;
|
||||
this.colorG = colorG;
|
||||
@@ -101,13 +101,13 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
EmissionColorChange.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid),
|
||||
EmissionColorChange.GenerateElement(elementName, elementGuid, tags, false, GetElement(attachedElementGuid),
|
||||
colorR.ConvertToGameType(), colorG.ConvertToGameType(), colorB.ConvertToGameType(), colorI.ConvertToGameType());
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return EmissionColorChange.GenerateElement(elementName, elementGuid, tags, parent,
|
||||
return EmissionColorChange.GenerateElement(elementName, elementGuid, tags, false, parent,
|
||||
colorR.ConvertToGameType(), colorG.ConvertToGameType(), colorB.ConvertToGameType(), colorI.ConvertToGameType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,30 +13,29 @@ namespace Ichni.RhythmGame
|
||||
public TrackTimeSubmoduleStatic targetTrackTimeSubmoduleStatic;
|
||||
|
||||
public static TrackTotalTimeChange GenerateElement(string elementName, Guid id,
|
||||
List<string> tags, Track targetTrack, FlexibleFloat totalTime)
|
||||
List<string> tags, bool isFirstGenerated, Track animatedTrack, FlexibleFloat totalTime)
|
||||
{
|
||||
TrackTotalTimeChange trackTotalTimeChange = Instantiate(EditorManager.instance.basePrefabs.emptyObject)
|
||||
.AddComponent<TrackTotalTimeChange>();
|
||||
trackTotalTimeChange.Initialize(elementName, id, tags);
|
||||
trackTotalTimeChange.Initialize(elementName, id, tags, isFirstGenerated);
|
||||
|
||||
trackTotalTimeChange.targetObject = targetTrack;
|
||||
trackTotalTimeChange.animatedObject = animatedTrack;
|
||||
|
||||
if (targetTrack.trackTimeSubmodule is TrackTimeSubmoduleStatic submoduleStatic)
|
||||
{
|
||||
trackTotalTimeChange.targetTrackTimeSubmoduleStatic = submoduleStatic;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new System.Exception("Target object does not have a TrackTimeSubmoduleStatic");
|
||||
}
|
||||
trackTotalTimeChange.targetTrackTimeSubmoduleStatic = animatedTrack.trackTimeSubmodule as TrackTimeSubmoduleStatic;
|
||||
|
||||
trackTotalTimeChange.totalTime = totalTime;
|
||||
trackTotalTimeChange.animationReturnType = FlexibleReturnType.Before;
|
||||
trackTotalTimeChange.timeDurationSubmodule.SetDuration(totalTime);
|
||||
//trackTotalTimeChange.timeDurationSubmodule.SetDuration(totalTime);
|
||||
|
||||
trackTotalTimeChange.SetParent(targetTrack);
|
||||
trackTotalTimeChange.SetParent(animatedTrack);
|
||||
return trackTotalTimeChange;
|
||||
}
|
||||
|
||||
protected override void SetDefaultSubmodules()
|
||||
{
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
submoduleList.Add(timeDurationSubmodule);
|
||||
}
|
||||
|
||||
protected override void UpdateAnimation(float songTime)
|
||||
{
|
||||
@@ -53,13 +52,13 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new TrackTotalTimeChange_BM(elementName, elementGuid, tags, targetObject.matchedBM as Track_BM, totalTime.ConvertToBM());
|
||||
matchedBM = new TrackTotalTimeChange_BM(elementName, elementGuid, tags, animatedObject.matchedBM as Track_BM, totalTime.ConvertToBM());
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class TrackTotalTimeChange_BM : BaseElement_BM
|
||||
public class TrackTotalTimeChange_BM : GameElement_BM
|
||||
{
|
||||
public FlexibleFloat_BM totalTime;
|
||||
|
||||
@@ -69,22 +68,22 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
|
||||
public TrackTotalTimeChange_BM(string elementName, Guid elementGuid, List<string> tags,
|
||||
BaseElement_BM attachedElement, FlexibleFloat_BM totalTime) : base(elementName, elementGuid, tags,
|
||||
attachedElement)
|
||||
GameElement_BM attachedElement, FlexibleFloat_BM totalTime) :
|
||||
base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.totalTime = totalTime;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
TrackTotalTimeChange.GenerateElement(elementName, elementGuid, tags,
|
||||
TrackTotalTimeChange.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid) as Track, totalTime.ConvertToGameType());
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return TrackTotalTimeChange.GenerateElement(elementName, elementGuid, tags, parent as Track,
|
||||
totalTime.ConvertToGameType());
|
||||
return TrackTotalTimeChange.GenerateElement(elementName, elementGuid, tags, false,
|
||||
parent as Track, totalTime.ConvertToGameType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 Unity.Mathematics;
|
||||
using Unity.VisualScripting;
|
||||
@@ -12,43 +13,31 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class Displacement : AnimationBase
|
||||
{
|
||||
public TransformSubmodule targetTransformSubmodule;
|
||||
private TransformSubmodule targetTransformSubmodule;
|
||||
public FlexibleFloat positionX, positionY, positionZ;
|
||||
|
||||
public static Displacement GenerateElement(string elementName, Guid id,
|
||||
List<string> tags, BaseElement targetObject,
|
||||
List<string> tags, bool isFirstGenerated, GameElement animatedObject,
|
||||
FlexibleFloat positionX, FlexibleFloat positionY, FlexibleFloat positionZ)
|
||||
{
|
||||
Displacement displacement = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent<Displacement>();
|
||||
|
||||
displacement.Initialize(elementName, id, tags);
|
||||
displacement.Initialize(elementName, id, tags, isFirstGenerated);
|
||||
|
||||
displacement.targetObject = targetObject;
|
||||
displacement.animatedObject = animatedObject;
|
||||
|
||||
displacement.positionX = positionX;
|
||||
displacement.positionY = positionY;
|
||||
displacement.positionZ = positionZ;
|
||||
displacement.animationReturnType = FlexibleReturnType.Before;
|
||||
|
||||
if (targetObject.transformSubmodule != null)
|
||||
{
|
||||
displacement.targetTransformSubmodule = targetObject.transformSubmodule;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new System.Exception("Target object does not have a TransformSubmodule");
|
||||
}
|
||||
|
||||
displacement.SetParent(targetObject);
|
||||
|
||||
displacement.timeDurationSubmodule.SetDuration(positionX, positionY, positionZ);
|
||||
displacement.targetTransformSubmodule = (animatedObject as IHaveTransformSubmodule).transformSubmodule;
|
||||
|
||||
return displacement;
|
||||
}
|
||||
displacement.SetParent(animatedObject);
|
||||
|
||||
//displacement.timeDurationSubmodule.SetDuration(positionX, positionY, positionZ);
|
||||
|
||||
private void Start()
|
||||
{
|
||||
targetTransformSubmodule = targetObject.transformSubmodule;
|
||||
return displacement;
|
||||
}
|
||||
|
||||
protected override void UpdateAnimation(float songTime)
|
||||
@@ -89,14 +78,14 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.Displacement_BM(elementName, elementGuid, tags, parentElement.matchedBM,
|
||||
matchedBM = new Beatmap.Displacement_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
|
||||
positionX.ConvertToBM(), positionY.ConvertToBM(), positionZ.ConvertToBM());
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class Displacement_BM : BaseElement_BM
|
||||
public class Displacement_BM : AnimationBase_BM
|
||||
{
|
||||
public FlexibleFloat_BM positionX, positionY, positionZ;
|
||||
|
||||
@@ -106,7 +95,7 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
|
||||
public Displacement_BM(string elementName, Guid elementGuid, List<string> tags,
|
||||
BaseElement_BM attachedElement, FlexibleFloat_BM positionX, FlexibleFloat_BM positionY, FlexibleFloat_BM positionZ)
|
||||
GameElement_BM attachedElement, FlexibleFloat_BM positionX, FlexibleFloat_BM positionY, FlexibleFloat_BM positionZ)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.positionX = positionX;
|
||||
@@ -116,13 +105,13 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
Displacement.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid),
|
||||
Displacement.GenerateElement(elementName, elementGuid, tags, false, GetElement(attachedElementGuid),
|
||||
positionX.ConvertToGameType(), positionY.ConvertToGameType(), positionZ.ConvertToGameType());
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return Displacement.GenerateElement(elementName, elementGuid, tags, parent,
|
||||
return Displacement.GenerateElement(elementName, elementGuid, tags, false, parent,
|
||||
positionX.ConvertToGameType(), positionY.ConvertToGameType(), positionZ.ConvertToGameType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
@@ -13,41 +14,35 @@ namespace Ichni.RhythmGame
|
||||
public partial class LookAt : AnimationBase
|
||||
{
|
||||
public TransformSubmodule targetTransformSubmodule;
|
||||
public BaseElement lookAtObject;
|
||||
public GameElement lookAtObject;
|
||||
public FlexibleBool enabling;
|
||||
|
||||
public static LookAt GenerateElement(string elementName, Guid id,
|
||||
List<string> tags, BaseElement targetObject,
|
||||
BaseElement lookAtTarget, FlexibleBool enabling)
|
||||
List<string> tags, bool isFirstGenerated, GameElement animatedObject,
|
||||
GameElement lookAtTarget, FlexibleBool enabling)
|
||||
{
|
||||
LookAt look = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent<LookAt>();
|
||||
|
||||
look.Initialize(elementName, id, tags);
|
||||
look.Initialize(elementName, id, tags, isFirstGenerated);
|
||||
|
||||
look.targetObject = targetObject;
|
||||
look.animatedObject = animatedObject;
|
||||
look.lookAtObject = lookAtTarget;
|
||||
look.enabling = enabling;
|
||||
look.animationReturnType = FlexibleReturnType.Before;
|
||||
|
||||
if (targetObject.transformSubmodule != null)
|
||||
{
|
||||
look.targetTransformSubmodule = targetObject.transformSubmodule;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new System.Exception("Target object does not have a TransformSubmodule");
|
||||
}
|
||||
look.targetTransformSubmodule = (animatedObject as IHaveTransformSubmodule).transformSubmodule;
|
||||
|
||||
look.SetParent(targetObject);
|
||||
look.SetParent(animatedObject);
|
||||
|
||||
look.timeDurationSubmodule.SetDuration(-999f, 999f); //TODO: 换为(-delay, songLength)
|
||||
//look.timeDurationSubmodule.SetDuration(-999f, 999f); //TODO: 换为(-delay, songLength)
|
||||
|
||||
return look;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
|
||||
protected override void SetDefaultSubmodules()
|
||||
{
|
||||
targetTransformSubmodule = targetObject.transformSubmodule;
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
submoduleList.Add(timeDurationSubmodule);
|
||||
}
|
||||
|
||||
protected override void UpdateAnimation(float songTime)
|
||||
@@ -57,7 +52,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
animationReturnType = FlexibleReturnType.MiddleExecuting;
|
||||
Vector3 lookingDirection =
|
||||
(lookAtObject.transform.position - targetObject.transform.position).normalized;
|
||||
(lookAtObject.transform.position - animatedObject.transform.position).normalized;
|
||||
|
||||
Vector3 eulerAnglesOffset = Quaternion.LookRotation(lookingDirection).eulerAngles;
|
||||
|
||||
@@ -74,14 +69,14 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.LookAt_BM(elementName, elementGuid, tags, parentElement.matchedBM,
|
||||
matchedBM = new LookAt_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
|
||||
enabling.ConvertToBM(), lookAtObject.elementGuid);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class LookAt_BM : BaseElement_BM
|
||||
public class LookAt_BM : GameElement_BM
|
||||
{
|
||||
public FlexibleBool_BM enabling;
|
||||
public Guid lookAtObjectGuid;
|
||||
@@ -91,8 +86,8 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
|
||||
public LookAt_BM(string elementName, Guid elementGuid, List<string> tags,
|
||||
BaseElement_BM attachedElement, FlexibleBool_BM enabling, Guid lookAtObjectGuid) : base(elementName,
|
||||
elementGuid, tags, attachedElement)
|
||||
GameElement_BM attachedElement, FlexibleBool_BM enabling, Guid lookAtObjectGuid)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.enabling = enabling;
|
||||
this.lookAtObjectGuid = lookAtObjectGuid;
|
||||
@@ -100,13 +95,13 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = LookAt.GenerateElement(elementName, elementGuid, tags,
|
||||
matchedElement = LookAt.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid), GetElement(lookAtObjectGuid), enabling.ConvertToGameType());
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return LookAt.GenerateElement(elementName, elementGuid, tags, parent,
|
||||
return LookAt.GenerateElement(elementName, elementGuid, tags, false, parent,
|
||||
GetElement(lookAtObjectGuid), enabling.ConvertToGameType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
@@ -11,34 +12,33 @@ namespace Ichni.RhythmGame
|
||||
public FlexibleFloat scaleX, scaleY, scaleZ;
|
||||
|
||||
public static Scale GenerateElement(string elementName, Guid id,
|
||||
List<string> tags, BaseElement targetObject,
|
||||
List<string> tags, bool isFirstGenerated, GameElement animatedObject,
|
||||
FlexibleFloat scaleX, FlexibleFloat scaleY, FlexibleFloat scaleZ)
|
||||
{
|
||||
Scale scale = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent<Scale>();
|
||||
|
||||
scale.Initialize(elementName, id, tags);
|
||||
scale.Initialize(elementName, id, tags, isFirstGenerated);
|
||||
|
||||
scale.targetObject = targetObject;
|
||||
scale.animatedObject = animatedObject;
|
||||
|
||||
scale.scaleX = scaleX;
|
||||
scale.scaleY = scaleY;
|
||||
scale.scaleZ = scaleZ;
|
||||
scale.animationReturnType = FlexibleReturnType.Before;
|
||||
|
||||
if (targetObject.transformSubmodule != null)
|
||||
{
|
||||
scale.targetTransformSubmodule = targetObject.transformSubmodule;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new System.Exception("Target object does not have a TransformSubmodule");
|
||||
}
|
||||
scale.targetTransformSubmodule = (animatedObject as IHaveTransformSubmodule).transformSubmodule;
|
||||
|
||||
scale.SetParent(targetObject);
|
||||
scale.timeDurationSubmodule.SetDuration(scaleX, scaleY, scaleZ);
|
||||
scale.SetParent(animatedObject);
|
||||
//scale.timeDurationSubmodule.SetDuration(scaleX, scaleY, scaleZ);
|
||||
|
||||
return scale;
|
||||
}
|
||||
|
||||
protected override void SetDefaultSubmodules()
|
||||
{
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
submoduleList.Add(timeDurationSubmodule);
|
||||
}
|
||||
|
||||
protected override void UpdateAnimation(float songTime)
|
||||
{
|
||||
@@ -66,14 +66,14 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.Scale_BM(elementName, elementGuid, tags, parentElement.matchedBM,
|
||||
matchedBM = new Scale_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
|
||||
scaleX.ConvertToBM(), scaleY.ConvertToBM(), scaleZ.ConvertToBM());
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class Scale_BM : BaseElement_BM
|
||||
public class Scale_BM : GameElement_BM
|
||||
{
|
||||
public FlexibleFloat_BM scaleX, scaleY, scaleZ;
|
||||
|
||||
@@ -82,9 +82,8 @@ namespace Ichni.RhythmGame
|
||||
|
||||
}
|
||||
|
||||
public Scale_BM(string elementName, Guid elementGuid, List<string> tags,
|
||||
BaseElement_BM attachedElement, FlexibleFloat_BM scaleX, FlexibleFloat_BM scaleY,
|
||||
FlexibleFloat_BM scaleZ)
|
||||
public Scale_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,
|
||||
FlexibleFloat_BM scaleX, FlexibleFloat_BM scaleY, FlexibleFloat_BM scaleZ)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.scaleX = scaleX;
|
||||
@@ -94,14 +93,14 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
Scale.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid),
|
||||
Scale.GenerateElement(elementName, elementGuid, tags, false, GetElement(attachedElementGuid),
|
||||
scaleX.ConvertToGameType(), scaleY.ConvertToGameType(), scaleZ.ConvertToGameType());
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return Scale.GenerateElement(elementName, elementGuid, tags, parent, scaleX.ConvertToGameType(),
|
||||
scaleY.ConvertToGameType(), scaleZ.ConvertToGameType());
|
||||
return Scale.GenerateElement(elementName, elementGuid, tags, false,
|
||||
parent, scaleX.ConvertToGameType(), scaleY.ConvertToGameType(), scaleZ.ConvertToGameType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -8,40 +9,39 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class Swirl : AnimationBase
|
||||
{
|
||||
public TransformSubmodule targetTransformSubmodule;
|
||||
private TransformSubmodule targetTransformSubmodule;
|
||||
public FlexibleFloat eulerAngleX, eulerAngleY, eulerAngleZ;
|
||||
|
||||
public static Swirl GenerateElement(string elementName, Guid id,
|
||||
List<string> tags, BaseElement targetObject,
|
||||
List<string> tags, bool isFirstGenerated, GameElement animatedObject,
|
||||
FlexibleFloat eulerAngleX, FlexibleFloat eulerAngleY, FlexibleFloat eulerAngleZ)
|
||||
{
|
||||
Swirl swirl = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent<Swirl>();
|
||||
|
||||
swirl.Initialize(elementName, id, tags);
|
||||
swirl.Initialize(elementName, id, tags, isFirstGenerated);
|
||||
|
||||
swirl.targetObject = targetObject;
|
||||
swirl.animatedObject = animatedObject;
|
||||
|
||||
swirl.eulerAngleX = eulerAngleX;
|
||||
swirl.eulerAngleY = eulerAngleY;
|
||||
swirl.eulerAngleZ = eulerAngleZ;
|
||||
swirl.animationReturnType = FlexibleReturnType.Before;
|
||||
|
||||
if (targetObject.transformSubmodule != null)
|
||||
{
|
||||
swirl.targetTransformSubmodule = targetObject.transformSubmodule;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new System.Exception("Target object does not have a TransformSubmodule");
|
||||
}
|
||||
swirl.targetTransformSubmodule = (animatedObject as IHaveTransformSubmodule).transformSubmodule;
|
||||
|
||||
swirl.SetParent(animatedObject);
|
||||
|
||||
swirl.SetParent(targetObject);
|
||||
|
||||
swirl.timeDurationSubmodule.SetDuration(eulerAngleX, eulerAngleY, eulerAngleZ);
|
||||
//swirl.timeDurationSubmodule.SetDuration(eulerAngleX, eulerAngleY, eulerAngleZ);
|
||||
|
||||
return swirl;
|
||||
}
|
||||
|
||||
protected override void SetDefaultSubmodules()
|
||||
{
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
submoduleList.Add(timeDurationSubmodule);
|
||||
}
|
||||
|
||||
protected override void UpdateAnimation(float songTime)
|
||||
{
|
||||
eulerAngleX.UpdateFlexibleFloat(songTime);
|
||||
@@ -68,14 +68,14 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.Swirl_BM(elementName, elementGuid, tags, parentElement.matchedBM,
|
||||
matchedBM = new Swirl_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
|
||||
eulerAngleX.ConvertToBM(), eulerAngleY.ConvertToBM(), eulerAngleZ.ConvertToBM());
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class Swirl_BM : BaseElement_BM
|
||||
public class Swirl_BM : AnimationBase_BM
|
||||
{
|
||||
public FlexibleFloat_BM eulerAngleX, eulerAngleY, eulerAngleZ;
|
||||
public Swirl_BM()
|
||||
@@ -83,8 +83,8 @@ namespace Ichni.RhythmGame
|
||||
|
||||
}
|
||||
|
||||
public Swirl_BM(string elementName, Guid elementGuid, List<string> tags,
|
||||
BaseElement_BM attachedElement, FlexibleFloat_BM eulerAngleX, FlexibleFloat_BM eulerAngleY, FlexibleFloat_BM eulerAngleZ)
|
||||
public Swirl_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,
|
||||
FlexibleFloat_BM eulerAngleX, FlexibleFloat_BM eulerAngleY, FlexibleFloat_BM eulerAngleZ)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
this.eulerAngleX = eulerAngleX;
|
||||
@@ -94,13 +94,13 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
Swirl.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid),
|
||||
Swirl.GenerateElement(elementName, elementGuid, tags, false, GetElement(attachedElementGuid),
|
||||
eulerAngleX.ConvertToGameType(), eulerAngleY.ConvertToGameType(), eulerAngleZ.ConvertToGameType());
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return Swirl.GenerateElement(elementName, elementGuid, tags, parent,
|
||||
return Swirl.GenerateElement(elementName, elementGuid, tags, false, parent,
|
||||
eulerAngleX.ConvertToGameType(), eulerAngleY.ConvertToGameType(), eulerAngleZ.ConvertToGameType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,262 +9,102 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
[System.Serializable]
|
||||
public abstract partial class BaseElement : SerializedMonoBehaviour
|
||||
public interface IBaseElement
|
||||
{
|
||||
//物体名
|
||||
public string elementName;
|
||||
|
||||
//标识 GUID
|
||||
public Guid elementGuid;
|
||||
public BaseElement_BM matchedBM { get; set; }
|
||||
|
||||
//标签
|
||||
public List<string> tags;
|
||||
|
||||
//存档
|
||||
public BaseElement_BM matchedBM;
|
||||
|
||||
//父游戏物体
|
||||
public BaseElement parentElement;
|
||||
|
||||
//子物体列表
|
||||
public List<BaseElement> childElementList = new List<BaseElement>();
|
||||
|
||||
//次级模块
|
||||
public List<SubmoduleBase> submoduleList = new List<SubmoduleBase>();
|
||||
|
||||
|
||||
public TimeDurationSubmodule timeDurationSubmodule;
|
||||
public TransformSubmodule transformSubmodule;
|
||||
public ColorSubmodule colorSubmodule;
|
||||
|
||||
/// <summary>
|
||||
/// 首次初始化
|
||||
/// </summary>
|
||||
/// <param name="name">物体名</param>
|
||||
public virtual void Initialize(string name, Guid elementGuid, List<string> tags)
|
||||
{
|
||||
this.elementName = name;
|
||||
this.elementGuid = elementGuid;
|
||||
this.tags = tags;
|
||||
EditorManager.instance.elementList.Add(this);
|
||||
submoduleList = new List<SubmoduleBase>();
|
||||
//GameManager.beatMapContainer.beatMapElementList.Add(this);
|
||||
//serialNumber = totalSerialNumber++;
|
||||
//SetTransformObserver();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在所有物体生成完毕后,执行的初始化方法
|
||||
/// </summary>
|
||||
public virtual void AfterInitialize()
|
||||
{
|
||||
submoduleList.Add(timeDurationSubmodule);
|
||||
submoduleList.Add(transformSubmodule);
|
||||
submoduleList.Add(colorSubmodule);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刷新物体的状态
|
||||
/// </summary>
|
||||
public virtual void Refresh()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置父物体
|
||||
/// </summary>
|
||||
/// <param name="parentElement">父物体</param>
|
||||
public void SetParent(BaseElement parentElement)
|
||||
{
|
||||
if (parentElement != null)
|
||||
{
|
||||
parentElement.childElementList.Add(this);
|
||||
this.parentElement = parentElement;
|
||||
transform.SetParent(parentElement.transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public abstract partial class BaseElement
|
||||
{
|
||||
private void Start()
|
||||
{
|
||||
SetTransformObserver();
|
||||
}
|
||||
|
||||
public virtual void SetTimeDuration()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void ApplyTimeDuration()
|
||||
{
|
||||
childElementList.ForEach(x => x.ApplyTimeDuration());
|
||||
timeDurationSubmodule?.SetDurationFromChildren(childElementList.Select(x => x.timeDurationSubmodule)
|
||||
.ToList());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置物体Transform的监听,顺序为Scale -> EulerAngles -> Position
|
||||
/// 如果有一些特殊的物体(例如Camera,ElementFolder),需要自定义监听,可以重写这个方法
|
||||
/// </summary>
|
||||
public virtual void SetTransformObserver()
|
||||
{
|
||||
Observable.EveryUpdate().Subscribe(_ =>
|
||||
{
|
||||
if (transformSubmodule == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (transformSubmodule.scaleDirtyMark)
|
||||
{
|
||||
Vector3 offset = Vector3.zero;
|
||||
foreach (Vector3 scaleOffset in transformSubmodule.scaleOffset)
|
||||
{
|
||||
offset += scaleOffset;
|
||||
}
|
||||
|
||||
transformSubmodule.currentScale = transformSubmodule.originalScale + offset;
|
||||
transform.localScale = transformSubmodule.currentScale;
|
||||
transformSubmodule.scaleDirtyMark = false;
|
||||
}
|
||||
|
||||
if (transformSubmodule.eulerAnglesDirtyMark)
|
||||
{
|
||||
Vector3 offset = Vector3.zero;
|
||||
foreach (Vector3 eulerOffset in transformSubmodule.eulerAnglesOffset)
|
||||
{
|
||||
offset += eulerOffset;
|
||||
}
|
||||
|
||||
transformSubmodule.currentEulerAngles = transformSubmodule.originalEulerAngles + offset;
|
||||
transform.localEulerAngles = transformSubmodule.currentEulerAngles;
|
||||
transformSubmodule.eulerAnglesDirtyMark = false;
|
||||
}
|
||||
|
||||
if (transformSubmodule.positionDirtyMark)
|
||||
{
|
||||
Vector3 offset = Vector3.zero;
|
||||
foreach (Vector3 posOffset in transformSubmodule.positionOffset)
|
||||
{
|
||||
offset += posOffset;
|
||||
}
|
||||
|
||||
transformSubmodule.currentPosition = transformSubmodule.originalPosition + offset;
|
||||
transform.localPosition = transformSubmodule.currentPosition;
|
||||
transformSubmodule.positionDirtyMark = false;
|
||||
}
|
||||
|
||||
transformSubmodule.scaleOffset.Clear();
|
||||
transformSubmodule.eulerAnglesOffset.Clear();
|
||||
transformSubmodule.positionOffset.Clear();
|
||||
}).AddTo(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract partial class BaseElement //存档,删除,复制,粘贴
|
||||
{
|
||||
/// <summary>
|
||||
/// 用于生成存档
|
||||
/// </summary>
|
||||
public abstract void SaveBM();
|
||||
|
||||
public void SaveBM();
|
||||
|
||||
/// <summary>
|
||||
/// 当物体被删除时执行的方法
|
||||
/// </summary>
|
||||
public virtual void OnDelete()
|
||||
{
|
||||
public void OnDelete();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除物体,包括所有子物体
|
||||
/// </summary>
|
||||
[Button("Delete")]
|
||||
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); //销毁
|
||||
}
|
||||
public void Delete();
|
||||
}
|
||||
|
||||
// public virtual void SetTimeDuration()
|
||||
// {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public void ApplyTimeDuration()
|
||||
// {
|
||||
// childElementList.ForEach(x => x.ApplyTimeDuration());
|
||||
// timeDurationSubmodule?.SetDurationFromChildren(
|
||||
// childElementList.Select(x => x.timeDurationSubmodule).ToList());
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 设置物体Transform的监听,顺序为Scale -> EulerAngles -> Position
|
||||
// /// 如果有一些特殊的物体(例如Camera,ElementFolder),需要自定义监听,可以重写这个方法
|
||||
// /// </summary>
|
||||
// public virtual void SetTransformObserver()
|
||||
// {
|
||||
// Observable.EveryUpdate().Subscribe(_ =>
|
||||
// {
|
||||
// if (transformSubmodule == null)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (transformSubmodule.scaleDirtyMark)
|
||||
// {
|
||||
// Vector3 offset = Vector3.zero;
|
||||
// foreach (Vector3 scaleOffset in transformSubmodule.scaleOffset)
|
||||
// {
|
||||
// offset += scaleOffset;
|
||||
// }
|
||||
//
|
||||
// transformSubmodule.currentScale = transformSubmodule.originalScale + offset;
|
||||
// transform.localScale = transformSubmodule.currentScale;
|
||||
// transformSubmodule.scaleDirtyMark = false;
|
||||
// }
|
||||
//
|
||||
// if (transformSubmodule.eulerAnglesDirtyMark)
|
||||
// {
|
||||
// Vector3 offset = Vector3.zero;
|
||||
// foreach (Vector3 eulerOffset in transformSubmodule.eulerAnglesOffset)
|
||||
// {
|
||||
// offset += eulerOffset;
|
||||
// }
|
||||
//
|
||||
// transformSubmodule.currentEulerAngles = transformSubmodule.originalEulerAngles + offset;
|
||||
// transform.localEulerAngles = transformSubmodule.currentEulerAngles;
|
||||
// transformSubmodule.eulerAnglesDirtyMark = false;
|
||||
// }
|
||||
//
|
||||
// if (transformSubmodule.positionDirtyMark)
|
||||
// {
|
||||
// Vector3 offset = Vector3.zero;
|
||||
// foreach (Vector3 posOffset in transformSubmodule.positionOffset)
|
||||
// {
|
||||
// offset += posOffset;
|
||||
// }
|
||||
//
|
||||
// transformSubmodule.currentPosition = transformSubmodule.originalPosition + offset;
|
||||
// transform.localPosition = transformSubmodule.currentPosition;
|
||||
// transformSubmodule.positionDirtyMark = false;
|
||||
// }
|
||||
//
|
||||
// transformSubmodule.scaleOffset.Clear();
|
||||
// transformSubmodule.eulerAnglesOffset.Clear();
|
||||
// transformSubmodule.positionOffset.Clear();
|
||||
// }).AddTo(gameObject);
|
||||
// }
|
||||
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
[System.Serializable]
|
||||
public abstract class BaseElement_BM
|
||||
{
|
||||
[System.NonSerialized]
|
||||
public static Dictionary<Guid, BaseElement_BM> identifier = new Dictionary<Guid, BaseElement_BM>(); //存档类的标识符
|
||||
|
||||
[System.NonSerialized]
|
||||
public BaseElement matchedElement; //存档类对应的游戏物体
|
||||
|
||||
public string elementName;
|
||||
public List<string> tags;
|
||||
public Guid elementGuid;
|
||||
public Guid attachedElementGuid;
|
||||
|
||||
public BaseElement_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public BaseElement_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM attachedElement)
|
||||
{
|
||||
this.elementName = elementName;
|
||||
this.elementGuid = elementGuid;
|
||||
this.tags = tags;
|
||||
|
||||
this.attachedElementGuid = attachedElement?.elementGuid ?? Guid.Empty;
|
||||
|
||||
identifier.TryAdd(this.elementGuid, this);
|
||||
}
|
||||
|
||||
public static BaseElement_BM GetElementBM(Guid id)
|
||||
{
|
||||
if (identifier.TryGetValue(id, out BaseElement_BM element_BM))
|
||||
{
|
||||
return element_BM;
|
||||
}
|
||||
|
||||
Debug.LogAssertion("Element not found or do not have id");
|
||||
return null;
|
||||
}
|
||||
|
||||
public static BaseElement GetElement(Guid id)
|
||||
{
|
||||
return GetElementBM(id)?.matchedElement;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用于从存档中生成物体
|
||||
/// </summary>
|
||||
public abstract void ExecuteBM();
|
||||
|
||||
/// <summary>
|
||||
/// 用于复制物体
|
||||
/// </summary>
|
||||
public abstract BaseElement DuplicateBM(BaseElement parent);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
@@ -22,7 +23,7 @@ namespace Ichni.RhythmGame
|
||||
public bool baseColorDirtyMark;
|
||||
public bool emissionColorDirtyMark;
|
||||
|
||||
public ColorSubmodule(BaseElement attachedElement) : base(attachedElement)
|
||||
public ColorSubmodule(GameElement attachedGameElement) : base(attachedGameElement)
|
||||
{
|
||||
this.originalBaseColor = Color.white;
|
||||
this.emissionEnabled = false;
|
||||
@@ -37,7 +38,7 @@ namespace Ichni.RhythmGame
|
||||
this.emissionColorDirtyMark = false;
|
||||
}
|
||||
|
||||
public ColorSubmodule(BaseElement attachedElement, Color originalBaseColor) : base(attachedElement)
|
||||
public ColorSubmodule(GameElement attachedGameElement, Color originalBaseColor) : base(attachedGameElement)
|
||||
{
|
||||
this.originalBaseColor = originalBaseColor;
|
||||
this.emissionEnabled = false;
|
||||
@@ -52,8 +53,8 @@ namespace Ichni.RhythmGame
|
||||
this.emissionColorDirtyMark = false;
|
||||
}
|
||||
|
||||
public ColorSubmodule(BaseElement attachedElement, Color originalBaseColor, bool emissionEnabled,
|
||||
Color originalEmissionColor, float originalEmissionIntensity) : base(attachedElement)
|
||||
public ColorSubmodule(GameElement attachedGameElement, Color originalBaseColor, bool emissionEnabled,
|
||||
Color originalEmissionColor, float originalEmissionIntensity) : base(attachedGameElement)
|
||||
{
|
||||
this.originalBaseColor = originalBaseColor;
|
||||
this.emissionEnabled = emissionEnabled;
|
||||
@@ -70,10 +71,14 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.ColorSubmodule_BM(attachedElement, originalBaseColor, emissionEnabled,
|
||||
originalEmissionColor, originalEmissionIntensity);
|
||||
matchedBM = new ColorSubmodule_BM(attachedGameElement);
|
||||
}
|
||||
}
|
||||
|
||||
public interface IHaveColorSubmodule
|
||||
{
|
||||
public ColorSubmodule colorSubmodule { get; set; }
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
@@ -89,25 +94,25 @@ namespace Ichni.RhythmGame
|
||||
|
||||
}
|
||||
|
||||
public ColorSubmodule_BM(BaseElement attachedElement, Color originalBaseColor, bool emissionEnabled,
|
||||
Color originalEmissionColor, float originalEmissionIntensity) : base(attachedElement)
|
||||
public ColorSubmodule_BM(GameElement attachedElement) : base(attachedElement)
|
||||
{
|
||||
this.originalBaseColor = originalBaseColor;
|
||||
this.emissionEnabled = emissionEnabled;
|
||||
this.originalEmissionColor = originalEmissionColor;
|
||||
this.originalEmissionIntensity = originalEmissionIntensity;
|
||||
ColorSubmodule colorSubmodule = (attachedElement as IHaveColorSubmodule).colorSubmodule;
|
||||
this.originalBaseColor = colorSubmodule.originalBaseColor;
|
||||
this.emissionEnabled = colorSubmodule.emissionEnabled;
|
||||
this.originalEmissionColor = colorSubmodule.originalEmissionColor;
|
||||
this.originalEmissionIntensity = colorSubmodule.originalEmissionIntensity;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
attachedElement = GetElement(attachedElementGuid);
|
||||
attachedElement.colorSubmodule = new ColorSubmodule(attachedElement, originalBaseColor, emissionEnabled,
|
||||
attachedElement = GameElement_BM.GetElement(attachedElementGuid);
|
||||
(attachedElement as IHaveColorSubmodule).colorSubmodule = new ColorSubmodule(attachedElement, originalBaseColor, emissionEnabled,
|
||||
originalEmissionColor, originalEmissionIntensity);
|
||||
}
|
||||
|
||||
public override void DuplicateBM(BaseElement attached)
|
||||
public override void DuplicateBM(GameElement attached)
|
||||
{
|
||||
attached.colorSubmodule = new ColorSubmodule(attached, originalBaseColor, emissionEnabled,
|
||||
(attachedElement as IHaveColorSubmodule).colorSubmodule = new ColorSubmodule(attached, originalBaseColor, emissionEnabled,
|
||||
originalEmissionColor, originalEmissionIntensity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,65 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class EffectSubmodule : SubmoduleBase
|
||||
public partial class EffectSubmodule : SubmoduleBase
|
||||
{
|
||||
public List<EffectBase> effectList;
|
||||
public Dictionary<string, List<EffectBase>> effectCollection;
|
||||
|
||||
public EffectSubmodule(BaseElement attachedElement) : base(attachedElement)
|
||||
public EffectSubmodule(GameElement attachedGameElement, EffectSubmodulePreset preset = EffectSubmodulePreset.Default)
|
||||
: base(attachedGameElement)
|
||||
{
|
||||
effectList = new List<EffectBase>();
|
||||
effectCollection = new Dictionary<string, List<EffectBase>>();
|
||||
|
||||
if (preset == EffectSubmodulePreset.Default)
|
||||
{
|
||||
effectCollection.Add("Default", new List<EffectBase>());
|
||||
}
|
||||
else if (preset == EffectSubmodulePreset.Note)
|
||||
{
|
||||
effectCollection.Add("Generate", new List<EffectBase>());
|
||||
effectCollection.Add("GeneralJudge", new List<EffectBase>());
|
||||
effectCollection.Add("Perfect", new List<EffectBase>());
|
||||
effectCollection.Add("Good", new List<EffectBase>());
|
||||
effectCollection.Add("Bad", new List<EffectBase>());
|
||||
effectCollection.Add("Miss", new List<EffectBase>());
|
||||
}
|
||||
}
|
||||
|
||||
public EffectSubmodule(GameElement attachedGameElement, Dictionary<string, List<EffectBase_BM>> effectList_BM) : base(attachedGameElement)
|
||||
{
|
||||
effectCollection = new Dictionary<string, List<EffectBase>>();
|
||||
|
||||
foreach (var effect in effectList_BM)
|
||||
{
|
||||
List<EffectBase> effectList = new List<EffectBase>();
|
||||
foreach (var effectBM in effect.Value)
|
||||
{
|
||||
effectList.Add(effectBM.ConvertToGameType());
|
||||
}
|
||||
effectCollection.Add(effect.Key, effectList);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.EffectSubmodule_BM(attachedElement);
|
||||
matchedBM = new EffectSubmodule_BM(attachedGameElement);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class EffectSubmodule
|
||||
{
|
||||
public enum EffectSubmodulePreset
|
||||
{
|
||||
Default,
|
||||
Note,
|
||||
}
|
||||
}
|
||||
|
||||
public interface IHaveEffect
|
||||
public interface IHaveEffectSubmodule
|
||||
{
|
||||
public EffectSubmodule effectSubmodule { get; set; }
|
||||
}
|
||||
@@ -28,27 +68,38 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public class EffectSubmodule_BM : Submodule_BM
|
||||
{
|
||||
public List<EffectBase> effectList;
|
||||
public Dictionary<string, List<EffectBase_BM>> effectCollection;
|
||||
|
||||
public EffectSubmodule_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public EffectSubmodule_BM(BaseElement attachedElement) : base(attachedElement)
|
||||
public EffectSubmodule_BM(GameElement attachedElement) : base(attachedElement)
|
||||
{
|
||||
effectList = new List<EffectBase>();
|
||||
effectCollection = new Dictionary<string, List<EffectBase_BM>>();
|
||||
IHaveEffectSubmodule element = attachedElement as IHaveEffectSubmodule;
|
||||
|
||||
foreach (var effect in element.effectSubmodule.effectCollection)
|
||||
{
|
||||
List<EffectBase_BM> effectList = new List<EffectBase_BM>();
|
||||
foreach (var effectBase in effect.Value)
|
||||
{
|
||||
effectList.Add(effectBase.ConvertToBM());
|
||||
}
|
||||
effectCollection.Add(effect.Key, effectList);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
attachedElement = GetElement(attachedElementGuid);
|
||||
(attachedElement as IHaveEffect).effectSubmodule = new EffectSubmodule(attachedElement);
|
||||
attachedElement = GameElement_BM.GetElement(attachedElementGuid);
|
||||
(attachedElement as IHaveEffectSubmodule).effectSubmodule = new EffectSubmodule(attachedElement);
|
||||
}
|
||||
|
||||
public override void DuplicateBM(BaseElement attached)
|
||||
public override void DuplicateBM(GameElement attached)
|
||||
{
|
||||
(attached as IHaveEffect).effectSubmodule = new EffectSubmodule(attached);
|
||||
(attached as IHaveEffectSubmodule).effectSubmodule = new EffectSubmodule(attached);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -140,5 +191,31 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 转换为存档类
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public abstract EffectBase_BM ConvertToBM();
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public abstract class EffectBase_BM
|
||||
{
|
||||
public float effectTime;
|
||||
|
||||
public EffectBase_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public EffectBase_BM(float effectTime)
|
||||
{
|
||||
this.effectTime = effectTime;
|
||||
}
|
||||
|
||||
public abstract EffectBase ConvertToGameType();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,15 +6,15 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public abstract class SubmoduleBase
|
||||
public abstract class SubmoduleBase : IBaseElement
|
||||
{
|
||||
public BaseElement attachedElement;
|
||||
public GameElement attachedGameElement;
|
||||
|
||||
public Submodule_BM matchedBM;
|
||||
public BaseElement_BM matchedBM { get; set; }
|
||||
|
||||
public SubmoduleBase(BaseElement attachedElement)
|
||||
public SubmoduleBase(GameElement attachedGameElement)
|
||||
{
|
||||
this.attachedElement = attachedElement;
|
||||
this.attachedGameElement = attachedGameElement;
|
||||
}
|
||||
|
||||
public virtual void InitialRefresh()
|
||||
@@ -23,13 +23,23 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
|
||||
public abstract void SaveBM();
|
||||
|
||||
public virtual void OnDelete()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void Delete()
|
||||
{
|
||||
attachedGameElement.submoduleList.Remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public abstract class Submodule_BM
|
||||
public abstract class Submodule_BM : BaseElement_BM
|
||||
{
|
||||
[System.NonSerialized] public BaseElement attachedElement; //存档类对应的游戏物体
|
||||
[System.NonSerialized] public GameElement attachedElement; //存档类对应的游戏物体
|
||||
public Guid attachedElementGuid;
|
||||
|
||||
public Submodule_BM()
|
||||
@@ -37,30 +47,22 @@ namespace Ichni.RhythmGame
|
||||
|
||||
}
|
||||
|
||||
public Submodule_BM(BaseElement attachedElement)
|
||||
public Submodule_BM(GameElement attachedElement)
|
||||
{
|
||||
this.attachedElement = attachedElement;
|
||||
attachedElementGuid = attachedElement.elementGuid;
|
||||
}
|
||||
|
||||
public static BaseElement_BM GetElementBM(Guid id)
|
||||
{
|
||||
if (BaseElement_BM.identifier.TryGetValue(id, out BaseElement_BM element_BM))
|
||||
{
|
||||
return element_BM;
|
||||
}
|
||||
|
||||
Debug.LogAssertion("Element not found or do not have id");
|
||||
return null;
|
||||
}
|
||||
|
||||
public static BaseElement GetElement(Guid id)
|
||||
{
|
||||
return GetElementBM(id)?.matchedElement;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 从存档类中生成游戏物体
|
||||
/// </summary>
|
||||
public abstract void ExecuteBM();
|
||||
public abstract void DuplicateBM(BaseElement attached);
|
||||
|
||||
/// <summary>
|
||||
/// 复制物体
|
||||
/// </summary>
|
||||
/// <param name="attached">(对于物体)父物体,(对于次级模块)或挂载物体</param>
|
||||
public abstract void DuplicateBM(GameElement attached);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -11,14 +12,14 @@ namespace Ichni.RhythmGame
|
||||
public bool isOverridingDuration; //是否手动设置了时间区间,开启时,子物体的时间区间将被忽略
|
||||
public float startTime, endTime; //起止时间
|
||||
|
||||
public TimeDurationSubmodule(BaseElement attachedElement) : base(attachedElement)
|
||||
public TimeDurationSubmodule(GameElement attachedGameElement) : base(attachedGameElement)
|
||||
{
|
||||
isOverridingDuration = false;
|
||||
startTime = -999;//TODO: 换为-delay
|
||||
endTime = 999;//TODO: 换为songLength
|
||||
startTime = -32767;//TODO: 换为-delay
|
||||
endTime = 32767;//TODO: 换为songLength
|
||||
}
|
||||
|
||||
public TimeDurationSubmodule(BaseElement attachedElement, bool isOverridingDuration, float startTime, float endTime) : base(attachedElement)
|
||||
public TimeDurationSubmodule(GameElement attachedGameElement, bool isOverridingDuration, float startTime, float endTime) : base(attachedGameElement)
|
||||
{
|
||||
this.isOverridingDuration = isOverridingDuration;
|
||||
this.startTime = startTime;
|
||||
@@ -34,6 +35,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
this.startTime = startTime;
|
||||
this.endTime = endTime;
|
||||
this.isOverridingDuration = true;
|
||||
}
|
||||
|
||||
public void SetDuration(params FlexibleFloat[] flexibleFloats)
|
||||
@@ -76,10 +78,15 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.TimeDurationSubmodule_BM(attachedElement, this);
|
||||
matchedBM = new TimeDurationSubmodule_BM(attachedGameElement);
|
||||
}
|
||||
}
|
||||
|
||||
public interface IHaveTimeDurationSubmodule
|
||||
{
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class TimeDurationSubmodule_BM : Submodule_BM
|
||||
@@ -92,8 +99,9 @@ namespace Ichni.RhythmGame
|
||||
|
||||
}
|
||||
|
||||
public TimeDurationSubmodule_BM(BaseElement attachedElement, TimeDurationSubmodule timeDurationSubmodule) : base(attachedElement)
|
||||
public TimeDurationSubmodule_BM(GameElement attachedElement) : base(attachedElement)
|
||||
{
|
||||
TimeDurationSubmodule timeDurationSubmodule = (attachedElement as IHaveTimeDurationSubmodule).timeDurationSubmodule;
|
||||
isOverridingDuration = timeDurationSubmodule.isOverridingDuration;
|
||||
startTime = timeDurationSubmodule.startTime;
|
||||
endTime = timeDurationSubmodule.endTime;
|
||||
@@ -101,13 +109,15 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
attachedElement = GetElement(attachedElementGuid);
|
||||
attachedElement.timeDurationSubmodule = new TimeDurationSubmodule(attachedElement, isOverridingDuration, startTime, endTime);
|
||||
attachedElement = GameElement_BM.GetElement(attachedElementGuid);
|
||||
(attachedElement as IHaveTimeDurationSubmodule).timeDurationSubmodule =
|
||||
new TimeDurationSubmodule(attachedElement, isOverridingDuration, startTime, endTime);
|
||||
}
|
||||
|
||||
public override void DuplicateBM(BaseElement attached)
|
||||
public override void DuplicateBM(GameElement attached)
|
||||
{
|
||||
attached.timeDurationSubmodule = new TimeDurationSubmodule(attached, isOverridingDuration, startTime, endTime);
|
||||
(attachedElement as IHaveTimeDurationSubmodule).timeDurationSubmodule =
|
||||
new TimeDurationSubmodule(attached, isOverridingDuration, startTime, endTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UniRx;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
@@ -28,9 +29,9 @@ namespace Ichni.RhythmGame
|
||||
public bool scaleDirtyMark;
|
||||
|
||||
public bool eulerAnglesOffsetLock;
|
||||
|
||||
|
||||
public TransformSubmodule(BaseElement attachedElement) : base(attachedElement)
|
||||
|
||||
public TransformSubmodule(GameElement attachedGameElement) : base(attachedGameElement)
|
||||
{
|
||||
this.originalPosition = Vector3.zero;
|
||||
this.originalEulerAngles = Vector3.zero;
|
||||
@@ -49,12 +50,12 @@ namespace Ichni.RhythmGame
|
||||
scaleDirtyMark = false;
|
||||
|
||||
eulerAnglesOffsetLock = false;
|
||||
|
||||
attachedElement.SetTransformObserver();
|
||||
|
||||
// (attachedGameElement as IHaveTransformSubmodule).SetTransformObserver();
|
||||
}
|
||||
|
||||
public TransformSubmodule(BaseElement attachedElement,
|
||||
Vector3 originalPosition, Vector3 originalEulerAngles, Vector3 originalScale) : base(attachedElement)
|
||||
public TransformSubmodule(GameElement attachedGameElement,
|
||||
Vector3 originalPosition, Vector3 originalEulerAngles, Vector3 originalScale) : base(attachedGameElement)
|
||||
{
|
||||
this.originalPosition = originalPosition;
|
||||
this.originalEulerAngles = originalEulerAngles;
|
||||
@@ -73,13 +74,74 @@ namespace Ichni.RhythmGame
|
||||
scaleDirtyMark = false;
|
||||
|
||||
eulerAnglesOffsetLock = false;
|
||||
|
||||
attachedElement.SetTransformObserver();
|
||||
|
||||
// (attachedGameElement as IHaveTransformSubmodule).SetTransformObserver();
|
||||
}
|
||||
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.TransformSubmodule_BM(attachedElement, originalPosition, originalEulerAngles, originalScale);
|
||||
matchedBM = new TransformSubmodule_BM(attachedGameElement);
|
||||
}
|
||||
}
|
||||
|
||||
public interface IHaveTransformSubmodule
|
||||
{
|
||||
TransformSubmodule transformSubmodule { get; set; }
|
||||
|
||||
public void SetTransformObserver()
|
||||
{
|
||||
GameElement attachedGameElement = transformSubmodule.attachedGameElement;
|
||||
|
||||
Observable.EveryUpdate().Subscribe(_ =>
|
||||
{
|
||||
if (transformSubmodule == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (transformSubmodule.scaleDirtyMark)
|
||||
{
|
||||
Vector3 offset = Vector3.zero;
|
||||
foreach (Vector3 scaleOffset in transformSubmodule.scaleOffset)
|
||||
{
|
||||
offset += scaleOffset;
|
||||
}
|
||||
|
||||
transformSubmodule.currentScale = transformSubmodule.originalScale + offset;
|
||||
attachedGameElement.transform.localScale = transformSubmodule.currentScale;
|
||||
transformSubmodule.scaleDirtyMark = false;
|
||||
}
|
||||
|
||||
if (transformSubmodule.eulerAnglesDirtyMark)
|
||||
{
|
||||
Vector3 offset = Vector3.zero;
|
||||
foreach (Vector3 eulerOffset in transformSubmodule.eulerAnglesOffset)
|
||||
{
|
||||
offset += eulerOffset;
|
||||
}
|
||||
|
||||
transformSubmodule.currentEulerAngles = transformSubmodule.originalEulerAngles + offset;
|
||||
attachedGameElement.transform.localEulerAngles = transformSubmodule.currentEulerAngles;
|
||||
transformSubmodule.eulerAnglesDirtyMark = false;
|
||||
}
|
||||
|
||||
if (transformSubmodule.positionDirtyMark)
|
||||
{
|
||||
Vector3 offset = Vector3.zero;
|
||||
foreach (Vector3 posOffset in transformSubmodule.positionOffset)
|
||||
{
|
||||
offset += posOffset;
|
||||
}
|
||||
|
||||
transformSubmodule.currentPosition = transformSubmodule.originalPosition + offset;
|
||||
attachedGameElement.transform.localPosition = transformSubmodule.currentPosition;
|
||||
transformSubmodule.positionDirtyMark = false;
|
||||
}
|
||||
|
||||
transformSubmodule.scaleOffset.Clear();
|
||||
transformSubmodule.eulerAnglesOffset.Clear();
|
||||
transformSubmodule.positionOffset.Clear();
|
||||
}).AddTo(attachedGameElement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,30 +152,31 @@ namespace Ichni.RhythmGame
|
||||
public Vector3 originalPosition;
|
||||
public Vector3 originalEulerAngles;
|
||||
public Vector3 originalScale;
|
||||
|
||||
|
||||
public TransformSubmodule_BM()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public TransformSubmodule_BM(BaseElement attachedElement, Vector3 originalPosition,
|
||||
Vector3 originalEulerAngles, Vector3 originalScale) :
|
||||
base(attachedElement)
|
||||
public TransformSubmodule_BM(GameElement attachedElement) : base(attachedElement)
|
||||
{
|
||||
this.originalPosition = originalPosition;
|
||||
this.originalEulerAngles = originalEulerAngles;
|
||||
this.originalScale = originalScale;
|
||||
TransformSubmodule transformSubmodule = (attachedElement as IHaveTransformSubmodule).transformSubmodule;
|
||||
this.originalPosition = transformSubmodule.originalPosition;
|
||||
this.originalEulerAngles = transformSubmodule.originalEulerAngles;
|
||||
this.originalScale = transformSubmodule.originalScale;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
attachedElement = GetElement(attachedElementGuid);
|
||||
attachedElement.transformSubmodule = new TransformSubmodule(attachedElement, originalPosition, originalEulerAngles, originalScale);
|
||||
attachedElement = GameElement_BM.GetElement(attachedElementGuid);
|
||||
(attachedElement as IHaveTransformSubmodule).transformSubmodule =
|
||||
new TransformSubmodule(attachedElement, originalPosition, originalEulerAngles, originalScale);
|
||||
}
|
||||
|
||||
public override void DuplicateBM(BaseElement attached)
|
||||
public override void DuplicateBM(GameElement attached)
|
||||
{
|
||||
attached.transformSubmodule = new TransformSubmodule(attached, originalPosition, originalEulerAngles, originalScale);
|
||||
(attached as IHaveTransformSubmodule).transformSubmodule =
|
||||
new TransformSubmodule(attached, originalPosition, originalEulerAngles, originalScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Ichni
|
||||
public NoteBase.NoteJudgeType currentJudgeType;
|
||||
public BasePrefabsCollection basePrefabs;
|
||||
|
||||
public List<BaseElement> elementList = new List<BaseElement>();
|
||||
public List<GameElement> elementList = new List<GameElement>();
|
||||
|
||||
public List<BaseElement_BM> elementList_BM = new List<BaseElement_BM>();
|
||||
public List<Submodule_BM> submoduleList_BM = new List<Submodule_BM>();
|
||||
@@ -33,28 +33,28 @@ namespace Ichni
|
||||
|
||||
//currentJudgeType = NoteBase.NoteJudgeType.Perfect;
|
||||
|
||||
var f0 = ElementFolder.GenerateElement("Folder", Guid.NewGuid(), new List<string>(), null);
|
||||
var dis0 = Displacement.GenerateElement("Displacement-0",Guid.NewGuid(), new List<string>(),f0,
|
||||
var f0 = ElementFolder.GenerateElement("Folder", Guid.NewGuid(), new List<string>(), true, null);
|
||||
var dis0 = Displacement.GenerateElement("Displacement-0",Guid.NewGuid(), new List<string>(),true, f0,
|
||||
new FlexibleFloat(),
|
||||
new FlexibleFloat(new List<AnimatedFloat>(){new (0,2,0,10, AnimationCurveType.Linear)}),
|
||||
new FlexibleFloat());
|
||||
var t0 = Track.GenerateElement("Track", Guid.NewGuid(), new List<string>(), f0, Vector3.left * 5f);
|
||||
var t0 = Track.GenerateElement("Track", Guid.NewGuid(), new List<string>(), true, f0);
|
||||
t0.trackPathSubmodule = new TrackPathSubmodule(t0, Track.TrackSpaceType.Linear,
|
||||
Track.TrackSamplingType.TimeDistributed, false);
|
||||
t0.trackTimeSubmodule = new TrackTimeSubmoduleMovable(t0, 0, 2, 1, AnimationCurveType.OutQuad);
|
||||
var pp0 = TrackPercentPoint.GenerateElement("TrackPercentPoint-0", Guid.NewGuid(), new List<string>(), t0,
|
||||
var pp0 = TrackPercentPoint.GenerateElement("TrackPercentPoint-0", Guid.NewGuid(), new List<string>(), true, t0,
|
||||
new FlexibleFloat(new List<AnimatedFloat>() { new(0, 2, 0, 1, AnimationCurveType.OutQuad) }));
|
||||
var tr0 = Trail.GenerateElement("Trail-0", Guid.NewGuid(), new List<string>(), pp0, 5);
|
||||
var tr0 = Trail.GenerateElement("Trail-0", Guid.NewGuid(), new List<string>(), true, pp0, 5);
|
||||
// t0.trackRendererSubmodule = new TrackRendererSubmoduleAutoOrient(t0);
|
||||
var p0 = PathNode.GenerateElement("PathNode-0", Guid.NewGuid(), new List<string>(), t0);
|
||||
var p0 = PathNode.GenerateElement("PathNode-0", Guid.NewGuid(), new List<string>(), true, t0);
|
||||
p0.transformSubmodule = new TransformSubmodule(p0, new Vector3(-5, 5, 10), Vector3.forward, Vector3.one);
|
||||
p0.colorSubmodule = new ColorSubmodule(p0, Color.white);
|
||||
var p1 = PathNode.GenerateElement("PathNode-1", Guid.NewGuid(), new List<string>(), t0);
|
||||
var p1 = PathNode.GenerateElement("PathNode-1", Guid.NewGuid(), new List<string>(), true, t0);
|
||||
p1.transformSubmodule = new TransformSubmodule(p1, new Vector3(5, -5, 10), Vector3.forward, Vector3.one);
|
||||
p1.colorSubmodule = new ColorSubmodule(p1, Color.red);
|
||||
var n0 = Tap.GenerateElement("Note-0", Guid.NewGuid(), new List<string>(), 1f, t0);
|
||||
var n0v = BasicNoteVisual.GenerateElement("Note-0-V", Guid.NewGuid(), new List<string>(), "basic",
|
||||
"BasicNoteTap3D", Vector3.zero, Vector3.zero, Vector3.one, n0);
|
||||
var n0 = Tap.GenerateElement("Note-0", Guid.NewGuid(), new List<string>(), true, t0, 1f);
|
||||
var n0v = BasicNoteVisual.GenerateElement("Note-0-V", Guid.NewGuid(), new List<string>(), true, n0,
|
||||
"basic", "BasicNoteTap3D");
|
||||
|
||||
elementList.ForEach(e =>
|
||||
{
|
||||
@@ -71,7 +71,7 @@ namespace Ichni
|
||||
|
||||
//Save
|
||||
elementList.ForEach(x => elementList_BM.Add(x.matchedBM));
|
||||
elementList.ForEach(x => submoduleList_BM.AddRange(x.submoduleList.ConvertAll(s => s.matchedBM)));
|
||||
elementList.ForEach(x => submoduleList_BM.AddRange(x.submoduleList.ConvertAll(s => s.matchedBM as Submodule_BM)));
|
||||
ES3.Save<List<Submodule_BM>>("submoduleList", submoduleList_BM);
|
||||
ES3.Save<List<BaseElement_BM>>("elementList", elementList_BM);
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame.ThemeBundles.Basic
|
||||
@@ -50,5 +52,31 @@ namespace Ichni.RhythmGame.ThemeBundles.Basic
|
||||
|
||||
return EffectState.Error;
|
||||
}
|
||||
|
||||
public override EffectBase_BM ConvertToBM()
|
||||
{
|
||||
return new Beatmap.BasicNoteBadExpand_BM(effectTime, note.elementGuid);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class BasicNoteBadExpand_BM : NoteEffectBase_BM
|
||||
{
|
||||
public BasicNoteBadExpand_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public BasicNoteBadExpand_BM(float effectTime, Guid attachedNoteID) : base(effectTime, attachedNoteID)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override EffectBase ConvertToGameType()
|
||||
{
|
||||
return new BasicNoteBadExpand(GameElement_BM.GetElement(attachedNoteID) as NoteBase);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using Ichni.RhythmGame;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame.ThemeBundles.Basic
|
||||
@@ -52,5 +54,33 @@ namespace Ichni.RhythmGame.ThemeBundles.Basic
|
||||
|
||||
return EffectState.Error;
|
||||
}
|
||||
|
||||
public override EffectBase_BM ConvertToBM()
|
||||
{
|
||||
return new Beatmap.BasicNoteGenerateExpand_BM(effectTime, generateTime, note.elementGuid);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class BasicNoteGenerateExpand_BM : NoteEffectBase_BM
|
||||
{
|
||||
public float generateTime;
|
||||
|
||||
public BasicNoteGenerateExpand_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public BasicNoteGenerateExpand_BM(float effectTime, float generateTime, Guid attachedNoteID) : base(effectTime, attachedNoteID)
|
||||
{
|
||||
this.generateTime = generateTime;
|
||||
}
|
||||
|
||||
public override EffectBase ConvertToGameType()
|
||||
{
|
||||
return new BasicNoteGenerateExpand(GameElement_BM.GetElement(attachedNoteID) as NoteBase);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Ichni.RhythmGame.ThemeBundles.Basic.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame.ThemeBundles.Basic
|
||||
@@ -54,5 +57,31 @@ namespace Ichni.RhythmGame.ThemeBundles.Basic
|
||||
|
||||
return EffectState.Error;
|
||||
}
|
||||
|
||||
public override EffectBase_BM ConvertToBM()
|
||||
{
|
||||
return new BasicNoteGoodBurst_BM(effectTime, note.elementGuid);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class BasicNoteGoodBurst_BM : NoteEffectBase_BM
|
||||
{
|
||||
public BasicNoteGoodBurst_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public BasicNoteGoodBurst_BM(float effectTime, Guid attachedNoteID) : base(effectTime, attachedNoteID)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override EffectBase ConvertToGameType()
|
||||
{
|
||||
return new BasicNoteGoodBurst(GameElement_BM.GetElement(attachedNoteID) as NoteBase);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame.ThemeBundles.Basic
|
||||
@@ -51,5 +53,31 @@ namespace Ichni.RhythmGame.ThemeBundles.Basic
|
||||
|
||||
return EffectState.Error;
|
||||
}
|
||||
|
||||
public override EffectBase_BM ConvertToBM()
|
||||
{
|
||||
return new Beatmap.BasicNoteMissPale_BM(effectTime, note.elementGuid);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class BasicNoteMissPale_BM : NoteEffectBase_BM
|
||||
{
|
||||
public BasicNoteMissPale_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public BasicNoteMissPale_BM(float effectTime, Guid elementGuid) : base(effectTime, elementGuid)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override EffectBase ConvertToGameType()
|
||||
{
|
||||
return new BasicNoteMissPale(GameElement_BM.GetElement(attachedNoteID) as NoteBase);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Ichni.RhythmGame.ThemeBundles.Basic.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame.ThemeBundles.Basic
|
||||
@@ -23,7 +26,7 @@ namespace Ichni.RhythmGame.ThemeBundles.Basic
|
||||
effectRing.GetComponent<SpriteRenderer>().color = Color.white;
|
||||
noteVisual.noteMain.SetActive(true);
|
||||
}
|
||||
|
||||
|
||||
public override void Adjust()
|
||||
{
|
||||
effectRing.gameObject.SetActive(true);
|
||||
@@ -54,5 +57,31 @@ namespace Ichni.RhythmGame.ThemeBundles.Basic
|
||||
|
||||
return EffectState.Error;
|
||||
}
|
||||
|
||||
public override EffectBase_BM ConvertToBM()
|
||||
{
|
||||
return new BasicNotePerfectBurst_BM(effectTime, note.elementGuid);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class BasicNotePerfectBurst_BM : NoteEffectBase_BM
|
||||
{
|
||||
public BasicNotePerfectBurst_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public BasicNotePerfectBurst_BM(float effectTime, Guid attachedNoteID) : base(effectTime, attachedNoteID)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override EffectBase ConvertToGameType()
|
||||
{
|
||||
return new BasicNotePerfectBurst(GameElement_BM.GetElement(attachedNoteID) as NoteBase);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,25 +10,23 @@ namespace Ichni.RhythmGame.ThemeBundles.Basic
|
||||
public partial class BasicNoteVisual : NoteVisualBase
|
||||
{
|
||||
public new static BasicNoteVisual GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
string themeBundleName, string objectName,
|
||||
Vector3 position, Vector3 eulerAngles, Vector3 scale, BaseElement parent, bool isFirstGenerated = true)
|
||||
bool isFirstGenerated, GameElement parentElement, string themeBundleName, string objectName)
|
||||
{
|
||||
BasicNoteVisual noteVisual = SubstantialObject
|
||||
.GenerateElement(elementName, id, tags, themeBundleName, objectName, position, eulerAngles, scale, parent, isFirstGenerated)
|
||||
.GetComponent<BasicNoteVisual>();
|
||||
BasicNoteVisual noteVisual = SubstantialObject.GenerateElement(elementName, id, tags,
|
||||
isFirstGenerated, themeBundleName, objectName, parentElement).GetComponent<BasicNoteVisual>();
|
||||
|
||||
NoteBase note = parent as NoteBase;
|
||||
NoteBase note = parentElement as NoteBase;
|
||||
if(note == null) throw new System.Exception("NoteVisual只能生成在Note下。");
|
||||
noteVisual.note = note;
|
||||
note.noteVisual = noteVisual;
|
||||
|
||||
if (isFirstGenerated)
|
||||
{
|
||||
note.generateEffects.effectList.Add(new BasicNoteGenerateExpand(noteVisual.note));
|
||||
note.perfectJudgeEffects.effectList.Add(new BasicNotePerfectBurst(noteVisual.note));
|
||||
note.goodJudgeEffects.effectList.Add(new BasicNoteGoodBurst(noteVisual.note));
|
||||
note.badJudgeEffects.effectList.Add(new BasicNoteBadExpand(noteVisual.note));
|
||||
note.missJudgeEffects.effectList.Add(new BasicNoteMissPale(noteVisual.note));
|
||||
note.effectSubmodule.effectCollection["Generate"].Add(new BasicNoteGenerateExpand(noteVisual.note));
|
||||
note.effectSubmodule.effectCollection["Perfect"].Add(new BasicNotePerfectBurst(noteVisual.note));
|
||||
note.effectSubmodule.effectCollection["Good"].Add(new BasicNoteGoodBurst(noteVisual.note));
|
||||
note.effectSubmodule.effectCollection["Bad"].Add(new BasicNoteBadExpand(noteVisual.note));
|
||||
note.effectSubmodule.effectCollection["Miss"].Add(new BasicNoteMissPale(noteVisual.note));
|
||||
}
|
||||
|
||||
return noteVisual;
|
||||
@@ -39,43 +37,35 @@ namespace Ichni.RhythmGame.ThemeBundles.Basic
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
|
||||
matchedBM = new Beatmap.BasicNoteVisual_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM, themeBundleName, objectName);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class BasicNoteVisual_BM : BaseElement_BM
|
||||
public class BasicNoteVisual_BM : SubstantialObject_BM
|
||||
{
|
||||
public BasicNoteVisual_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public BasicNoteVisual_BM(string elementName, Guid id, List<string> tags, BaseElement_BM parent,
|
||||
string themeBundleName, string objectName, Vector3 position, Vector3 eulerAngles, Vector3 scale) :
|
||||
base(elementName, id, tags, parent)
|
||||
public BasicNoteVisual_BM(string elementName, Guid id, List<string> tags,
|
||||
GameElement_BM parent, string themeBundleName, string objectName) :
|
||||
base(elementName, id, tags, parent, themeBundleName, objectName)
|
||||
{
|
||||
this.elementName = elementName;
|
||||
this.elementGuid = id;
|
||||
this.tags = tags;
|
||||
// this.themeBundleName = themeBundleName;
|
||||
// this.objectName = objectName;
|
||||
// this.position = position;
|
||||
// this.eulerAngles = eulerAngles;
|
||||
// this.scale = scale;
|
||||
// this.parent = parent;
|
||||
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
//TODO: 生成NoteVisual
|
||||
matchedElement = BasicNoteVisual.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid), themeBundleName, objectName);
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
//TODO: 生成NoteVisual
|
||||
return null;
|
||||
return BasicNoteVisual.GenerateElement(elementName, elementGuid, tags, false, parent, themeBundleName, objectName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user