基础内容-7
Trail 完整Note
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Lean.Pool;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class ElementFolder : BaseElement
|
||||
{
|
||||
public static ElementFolder GenerateElement(string name, BaseElement parentElement)
|
||||
{
|
||||
ElementFolder elementFolder = Instantiate(EditorManager.instance.basePrefabs.elementFolder).GetComponent<ElementFolder>();
|
||||
|
||||
elementFolder.Initialize(name);
|
||||
elementFolder.SetParent(parentElement);
|
||||
|
||||
elementFolder.transformSubmodule = new TransformSubmodule(elementFolder);
|
||||
elementFolder.timeDurationSubmodule = new TimeDurationSubmodule(elementFolder);
|
||||
//elementFolder.GenerateTab(parentElement);
|
||||
|
||||
elementFolder.SetTransformObserver();
|
||||
|
||||
return elementFolder;
|
||||
}
|
||||
}
|
||||
}
|
||||
8
Assets/Scripts/GameElements/ElementFolder.meta
Normal file
8
Assets/Scripts/GameElements/ElementFolder.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6944ee6ee5d024c15a16862148361df3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
64
Assets/Scripts/GameElements/ElementFolder/ElementFolder.cs
Normal file
64
Assets/Scripts/GameElements/ElementFolder/ElementFolder.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Lean.Pool;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class ElementFolder : BaseElement
|
||||
{
|
||||
public List<Track> trackList;
|
||||
|
||||
public static ElementFolder GenerateElement(string name, Guid id, List<string> tags, BaseElement parentElement)
|
||||
{
|
||||
ElementFolder elementFolder = Instantiate(EditorManager.instance.basePrefabs.elementFolder).GetComponent<ElementFolder>();
|
||||
|
||||
elementFolder.Initialize(name, id, tags);
|
||||
elementFolder.SetParent(parentElement);
|
||||
|
||||
elementFolder.transformSubmodule = new TransformSubmodule(elementFolder);
|
||||
elementFolder.timeDurationSubmodule = new TimeDurationSubmodule(elementFolder);
|
||||
//elementFolder.GenerateTab(parentElement);
|
||||
|
||||
elementFolder.SetTransformObserver();
|
||||
|
||||
return elementFolder;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class ElementFolder
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.ElementFolder_BM(elementName, elementGuid, tags, parentElement.matchedBM);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class ElementFolder_BM : BaseElement_BM
|
||||
{
|
||||
public ElementFolder_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ElementFolder_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM attachedElement)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = ElementFolder.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid));
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
{
|
||||
return ElementFolder.GenerateElement(elementName, elementGuid, tags, parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Lean.Pool;
|
||||
@@ -9,13 +10,14 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public bool isStatic;
|
||||
|
||||
public static SubstantialObject GenerateElement(string elementName, string themeBundleName,
|
||||
string objectName, Vector3 position, Vector3 eulerAngles, Vector3 scale, BaseElement parent,
|
||||
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)
|
||||
{
|
||||
EnvironmentObject themeBundleObject = ThemeBundleManager.instance.GetObject<EnvironmentObject>(themeBundleName, objectName);
|
||||
EnvironmentObject environmentObject = Instantiate(themeBundleObject, parent.transform).GetComponent<EnvironmentObject>();
|
||||
environmentObject.Initialize(elementName);
|
||||
environmentObject.Initialize(elementName, id, tags);
|
||||
environmentObject.isStatic = isStatic;
|
||||
return environmentObject;
|
||||
}
|
||||
|
||||
@@ -20,13 +20,14 @@ namespace Ichni.RhythmGame
|
||||
public float perspectiveAngle;
|
||||
public float orthographicSize;
|
||||
|
||||
public static GameCamera GenerateElement(string elementName, BaseElement parentElement,
|
||||
public static GameCamera GenerateElement(string elementName, Guid id,
|
||||
List<string> tags, BaseElement parentElement,
|
||||
CameraViewType cameraViewType, float perspectiveAngle, float orthographicSize,
|
||||
Vector3 initialPosition, Vector3 initialEulerAngles)
|
||||
{
|
||||
GameCamera gameCamera = Instantiate(EditorManager.instance.basePrefabs.gameCamera).GetComponent<GameCamera>();
|
||||
|
||||
gameCamera.Initialize(elementName);
|
||||
gameCamera.Initialize(elementName, id, tags);
|
||||
gameCamera.parentElement = parentElement;
|
||||
gameCamera.cameraViewType = cameraViewType;
|
||||
gameCamera.camera.orthographic = cameraViewType == CameraViewType.Orthographic;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Dreamteck.Splines;
|
||||
@@ -7,13 +8,14 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class Flick : NoteBase
|
||||
public partial class Flick : NoteBase
|
||||
{
|
||||
public List<Vector2> availableFlickDirections;
|
||||
public static Flick GenerateElement(string elementName, float exactJudgeTime, BaseElement attach, List<Vector2> directions)
|
||||
public static Flick GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
float exactJudgeTime, BaseElement attach, List<Vector2> directions)
|
||||
{
|
||||
Flick flick = Instantiate(EditorManager.instance.basePrefabs.tapNote, attach.transform).GetComponent<Flick>();
|
||||
flick.Initialize(elementName);
|
||||
flick.Initialize(elementName, id, tags);
|
||||
flick.exactJudgeTime = exactJudgeTime;
|
||||
flick.availableFlickDirections = directions;
|
||||
flick.transformSubmodule = new TransformSubmodule(flick);
|
||||
@@ -44,4 +46,42 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class Flick_BM : BaseElement_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)
|
||||
{
|
||||
this.exactJudgeTime = exactJudgeTime;
|
||||
availableFlickDirections = directions;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = Flick.GenerateElement(elementName, elementGuid, tags, exactJudgeTime, GetElement(attachedElementGuid), availableFlickDirections);
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
{
|
||||
return Flick.GenerateElement(elementName, elementGuid, tags, exactJudgeTime, parent, availableFlickDirections);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public abstract class NoteBase : BaseElement
|
||||
public abstract partial class NoteBase : BaseElement
|
||||
{
|
||||
[Title("Basic Info")]
|
||||
public float exactJudgeTime;
|
||||
@@ -41,9 +41,9 @@ namespace Ichni.RhythmGame
|
||||
public Vector2 noteScreenPosition;
|
||||
public bool isJudged;
|
||||
|
||||
public override void Initialize(string name)
|
||||
public override void Initialize(string name, Guid id, List<string> tags)
|
||||
{
|
||||
base.Initialize(name);
|
||||
base.Initialize(name, id, tags);
|
||||
generateEffects = new EffectSubmodule(this);
|
||||
generalJudgeEffects = new EffectSubmodule(this);
|
||||
perfectJudgeEffects = new EffectSubmodule(this);
|
||||
@@ -113,14 +113,23 @@ namespace Ichni.RhythmGame
|
||||
isJudged = true;
|
||||
}
|
||||
}
|
||||
|
||||
generateEffects.effectList.ForEach(e => e.UpdateEffect());
|
||||
|
||||
foreach (var effect in generateEffects.effectList)
|
||||
switch (EditorManager.instance.currentJudgeType)
|
||||
{
|
||||
effect.UpdateEffect();
|
||||
}
|
||||
foreach (var effect in perfectJudgeEffects.effectList)
|
||||
{
|
||||
effect.UpdateEffect();
|
||||
case NoteJudgeType.Perfect:
|
||||
perfectJudgeEffects.effectList.ForEach(e => e.UpdateEffect());
|
||||
break;
|
||||
case NoteJudgeType.Good:
|
||||
goodJudgeEffects.effectList.ForEach(e => e.UpdateEffect());
|
||||
break;
|
||||
case NoteJudgeType.Bad:
|
||||
badJudgeEffects.effectList.ForEach(e => e.UpdateEffect());
|
||||
break;
|
||||
case NoteJudgeType.Miss:
|
||||
missJudgeEffects.effectList.ForEach(e => e.UpdateEffect());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,4 +153,15 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public abstract partial class NoteBase
|
||||
{
|
||||
public enum NoteJudgeType
|
||||
{
|
||||
Perfect,
|
||||
Good,
|
||||
Bad,
|
||||
Miss
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,11 +13,5 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public List<GameObject> notePartList;
|
||||
public List<GameObject> effectPartList;
|
||||
|
||||
public void NewInitialize(NoteBase note)
|
||||
{
|
||||
base.Initialize(note.elementName + " Note Visual");
|
||||
this.note = note;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Dreamteck.Splines;
|
||||
@@ -7,12 +8,13 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class Stay : NoteBase
|
||||
public partial class Stay : NoteBase
|
||||
{
|
||||
public static Stay GenerateElement(string elementName, float exactJudgeTime, BaseElement attach)
|
||||
public static Stay GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
float exactJudgeTime, BaseElement attach)
|
||||
{
|
||||
Stay stay = Instantiate(EditorManager.instance.basePrefabs.tapNote, attach.transform).GetComponent<Stay>();
|
||||
stay.Initialize(elementName);
|
||||
stay.Initialize(elementName, id, tags);
|
||||
stay.exactJudgeTime = exactJudgeTime;
|
||||
stay.transformSubmodule = new TransformSubmodule(stay);
|
||||
stay.timeDurationSubmodule = new TimeDurationSubmodule(stay);
|
||||
@@ -42,4 +44,41 @@ namespace Ichni.RhythmGame
|
||||
return stay;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Stay
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.Stay_BM(elementName, elementGuid, tags, parentElement.matchedBM, exactJudgeTime);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class Stay_BM : BaseElement_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)
|
||||
{
|
||||
this.exactJudgeTime = exactJudgeTime;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = Stay.GenerateElement(elementName, elementGuid, tags, exactJudgeTime, GetElement(attachedElementGuid));
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
{
|
||||
return Stay.GenerateElement(elementName, elementGuid, tags, exactJudgeTime, parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Dreamteck.Splines;
|
||||
@@ -7,12 +8,13 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class Tap : NoteBase
|
||||
public partial class Tap : NoteBase
|
||||
{
|
||||
public static Tap GenerateElement(string elementName, float exactJudgeTime, BaseElement attach)
|
||||
public static Tap GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
float exactJudgeTime, BaseElement attach)
|
||||
{
|
||||
Tap tap = Instantiate(EditorManager.instance.basePrefabs.tapNote, attach.transform).GetComponent<Tap>();
|
||||
tap.Initialize(elementName);
|
||||
tap.Initialize(elementName, id, tags);
|
||||
tap.exactJudgeTime = exactJudgeTime;
|
||||
tap.transformSubmodule = new TransformSubmodule(tap);
|
||||
tap.timeDurationSubmodule = new TimeDurationSubmodule(tap);
|
||||
@@ -42,4 +44,41 @@ namespace Ichni.RhythmGame
|
||||
return tap;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Tap
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.Tap_BM(elementName, elementGuid, tags, parentElement.matchedBM, exactJudgeTime);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class Tap_BM : BaseElement_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)
|
||||
{
|
||||
this.exactJudgeTime = exactJudgeTime;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = Tap.GenerateElement(elementName, elementGuid, tags, exactJudgeTime, GetElement(attachedElementGuid));
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
{
|
||||
return Tap.GenerateElement(elementName, elementGuid, tags, exactJudgeTime, parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Lean.Pool;
|
||||
@@ -9,13 +10,13 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public string themeBundleName, objectName;
|
||||
|
||||
public static SubstantialObject GenerateElement(string elementName, 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,
|
||||
string themeBundleName, string objectName, Vector3 position, Vector3 eulerAngles, Vector3 scale,
|
||||
BaseElement parent, bool isFirstGenerated = true)
|
||||
{
|
||||
GameObject themeBundleObject = ThemeBundleManager.instance.GetObject<GameObject>(themeBundleName, objectName);
|
||||
SubstantialObject substantialObject = Instantiate(themeBundleObject, parent.transform).GetComponent<SubstantialObject>();
|
||||
substantialObject.Initialize(elementName);
|
||||
substantialObject.Initialize(elementName, id, tags);
|
||||
|
||||
substantialObject.transformSubmodule = new TransformSubmodule(substantialObject, position, eulerAngles, scale);
|
||||
substantialObject.timeDurationSubmodule = new TimeDurationSubmodule(substantialObject);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Dreamteck.Splines;
|
||||
@@ -18,12 +19,12 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public SplinePoint node;
|
||||
|
||||
public static PathNode GenerateElement(string elementName, Track track, int index, Vector3 nodePosition,
|
||||
Vector3 nodeNormal, float nodeSize, Color nodeColor)
|
||||
public static PathNode GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
Track track, Vector3 nodePosition, Vector3 nodeNormal, float nodeSize, Color nodeColor)
|
||||
{
|
||||
PathNode pathNode = Instantiate(EditorManager.instance.basePrefabs.pathNode, track.transform).GetComponent<PathNode>();
|
||||
|
||||
pathNode.Initialize(elementName);
|
||||
pathNode.Initialize(elementName, id, tags);
|
||||
pathNode.track = track;
|
||||
//pathNode.index = index;
|
||||
|
||||
|
||||
@@ -12,11 +12,12 @@ namespace Ichni.RhythmGame
|
||||
public TrackTimeSubmodule trackTimeSubmodule;
|
||||
public TrackRendererSubmodule trackRendererSubmodule;
|
||||
|
||||
public static Track GenerateElement(string elementName, BaseElement parent, Vector3 position)
|
||||
public static Track GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
BaseElement parent, Vector3 position)
|
||||
{
|
||||
Track track = Instantiate(EditorManager.instance.basePrefabs.track, parent.transform).GetComponent<Track>();
|
||||
|
||||
track.Initialize(elementName);
|
||||
track.Initialize(elementName, id, tags);
|
||||
track.SetParent(parent);
|
||||
|
||||
track.transformSubmodule = new TransformSubmodule(track, position, Vector3.zero, Vector3.one);
|
||||
@@ -47,9 +48,9 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public partial class Track
|
||||
{
|
||||
public override void Refresh()
|
||||
public override void SaveBM()
|
||||
{
|
||||
|
||||
matchedBM = new Beatmap.Track_BM(elementName, elementGuid, tags, parentElement.matchedBM);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,4 +69,31 @@ namespace Ichni.RhythmGame
|
||||
DistanceDistributed = 1
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class Track_BM : BaseElement_BM
|
||||
{
|
||||
public Track_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Track_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM attachedElement)
|
||||
: base(elementName, elementGuid, tags, attachedElement)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = Track.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid), Vector3.zero);
|
||||
}
|
||||
|
||||
public override BaseElement DuplicateBM(BaseElement parent)
|
||||
{
|
||||
return Track.GenerateElement(elementName, elementGuid, tags, parent, Vector3.zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Dreamteck.Splines;
|
||||
using Ichni.RhythmGame;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class CrossTrackPoint : BaseElement
|
||||
{
|
||||
public ElementFolder trackListFolder;
|
||||
public Track nowAttachedTrack;
|
||||
private int nowAttachedTrackIndex;
|
||||
public SplinePositioner trackPositioner;
|
||||
|
||||
public FlexibleInt trackSwitch;
|
||||
public FlexibleFloat trackPercent;
|
||||
|
||||
public static CrossTrackPoint GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
ElementFolder elementFolder, FlexibleInt trackSwitch, FlexibleFloat trackPercent)
|
||||
{
|
||||
CrossTrackPoint point = Instantiate(EditorManager.instance.basePrefabs.emptyObject, elementFolder.transform).AddComponent<CrossTrackPoint>();
|
||||
point.Initialize(elementName, id, tags);
|
||||
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;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (trackPercent.animations.Count > 0)
|
||||
{
|
||||
trackSwitch.UpdateFlexibleInt(EditorManager.instance.songModule.songTime);
|
||||
trackPercent.UpdateFlexibleFloat(EditorManager.instance.songModule.songTime);
|
||||
SetPoint();
|
||||
}
|
||||
}
|
||||
|
||||
private void SetPoint()
|
||||
{
|
||||
if (nowAttachedTrackIndex != trackSwitch.value && trackSwitch.value >= 0 && trackSwitch.value < trackListFolder.trackList.Count)
|
||||
{
|
||||
nowAttachedTrack = trackListFolder.trackList[trackSwitch.value];
|
||||
nowAttachedTrackIndex = trackSwitch.value;
|
||||
trackPositioner.spline = trackListFolder.trackList[trackSwitch.value].trackPathSubmodule.path;
|
||||
}
|
||||
|
||||
trackPositioner.SetPercent(trackPercent.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7dc68e9f357304d71a938d5e3f9b1125
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Dreamteck.Splines;
|
||||
@@ -12,24 +13,19 @@ namespace Ichni.RhythmGame
|
||||
public TrackTimeSubmoduleMovable trackTimeSubmoduleMovable;
|
||||
public SplinePositioner trackPositioner;
|
||||
|
||||
public static TrackHeadPoint GenerateElement(string elementName, Track track)
|
||||
public static TrackHeadPoint GenerateElement(string elementName, Guid id, List<string> tags, Track track)
|
||||
{
|
||||
TrackHeadPoint head = Instantiate(EditorManager.instance.basePrefabs.emptyObject, track.transform).AddComponent<TrackHeadPoint>();
|
||||
|
||||
head.NewInitialize(elementName, track);
|
||||
head.Initialize(elementName, id, tags);
|
||||
head.track = track;
|
||||
head.trackPositioner = head.gameObject.AddComponent<SplinePositioner>();
|
||||
head.trackPositioner.spline = track.trackPathSubmodule.path;
|
||||
head.trackTimeSubmoduleMovable = track.trackTimeSubmodule as TrackTimeSubmoduleMovable;
|
||||
head.SetParent(track);
|
||||
return head;
|
||||
}
|
||||
|
||||
private void NewInitialize(string elementName, Track track)
|
||||
{
|
||||
base.Initialize(elementName);
|
||||
this.track = track;
|
||||
this.trackPositioner = gameObject.AddComponent<SplinePositioner>();
|
||||
this.trackPositioner.spline = track.trackPathSubmodule.path;
|
||||
this.trackTimeSubmoduleMovable = track.trackTimeSubmodule as TrackTimeSubmoduleMovable;
|
||||
}
|
||||
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (track.timeDurationSubmodule.CheckTimeInDuration(EditorManager.instance.songModule.songTime))
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -19,27 +20,23 @@ namespace Ichni.RhythmGame
|
||||
|
||||
private bool isBeyond1 = false;
|
||||
|
||||
public static TrackPercentPoint GenerateElement(string elementName, Track track, FlexibleFloat trackPercent)
|
||||
public static TrackPercentPoint GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
Track track, FlexibleFloat trackPercent)
|
||||
{
|
||||
TrackPercentPoint point = Instantiate(EditorManager.instance.basePrefabs.emptyObject, track.transform).AddComponent<TrackPercentPoint>();
|
||||
|
||||
point.NewInitialize(elementName, track, trackPercent);
|
||||
point.Initialize(elementName, id, tags);
|
||||
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将会循环
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
private void NewInitialize(string elementName, Track track, FlexibleFloat trackPercent)
|
||||
{
|
||||
base.Initialize(elementName);
|
||||
this.track = track;
|
||||
this.trackPositioner = gameObject.AddComponent<SplinePositioner>();
|
||||
this.trackPositioner.spline = track.trackPathSubmodule.path;
|
||||
this.trackPercent = trackPercent;
|
||||
}
|
||||
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (trackPercent.animations.Count > 0)
|
||||
|
||||
32
Assets/Scripts/GameElements/Track/Trail.cs
Normal file
32
Assets/Scripts/GameElements/Track/Trail.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class Trail : BaseElement
|
||||
{
|
||||
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)
|
||||
{
|
||||
Trail trail = Instantiate(EditorManager.instance.basePrefabs.trail).GetComponent<Trail>();
|
||||
trail.trailRenderer = trail.GetComponent<TrailRenderer>();
|
||||
|
||||
trail.Initialize(name, id, tags);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/GameElements/Track/Trail.cs.meta
Normal file
11
Assets/Scripts/GameElements/Track/Trail.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48120e902e0734a51a10b8b4c0229afa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user