fix
This commit is contained in:
117
Assets/Scripts/Game/Animations/Track/TrackGlobalColorChange.cs
Normal file
117
Assets/Scripts/Game/Animations/Track/TrackGlobalColorChange.cs
Normal file
@@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class TrackGlobalColorChange : AnimationBase
|
||||
{
|
||||
public FlexibleFloat colorR, colorG, colorB, colorA;
|
||||
public static TrackGlobalColorChange GenerateElement(string elementName, System.Guid id,
|
||||
List<string> tags, bool isFirstGenerated, GameElement animatedObject,
|
||||
FlexibleFloat colorR, FlexibleFloat colorG, FlexibleFloat colorB, FlexibleFloat colorA)
|
||||
{
|
||||
if (animatedObject is not Track)
|
||||
{
|
||||
Debug.LogError("Animated Object is Not Track");
|
||||
throw new System.ArgumentException("Animated Object is Not Track");
|
||||
}
|
||||
TrackGlobalColorChange trackGlobalColorChange = Instantiate(GameManager.instance.basePrefabs.emptyObject).AddComponent<TrackGlobalColorChange>();
|
||||
|
||||
trackGlobalColorChange.Initialize(elementName, id, tags, isFirstGenerated, animatedObject);
|
||||
trackGlobalColorChange.animatedObject = animatedObject;
|
||||
|
||||
trackGlobalColorChange.colorR = colorR;
|
||||
trackGlobalColorChange.colorG = colorG;
|
||||
trackGlobalColorChange.colorB = colorB;
|
||||
trackGlobalColorChange.colorA = colorA;
|
||||
trackGlobalColorChange.animationReturnType = FlexibleReturnType.Before;
|
||||
|
||||
//trackGlobalColorChange.timeDurationSubmodule.SetDuration(colorR, colorG, colorB, colorA);
|
||||
|
||||
return trackGlobalColorChange;
|
||||
}
|
||||
public override void SetDefaultSubmodules()
|
||||
{
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
}
|
||||
protected override void UpdateAnimation(float songTime)
|
||||
{
|
||||
colorR.UpdateFlexibleFloat(songTime);
|
||||
colorG.UpdateFlexibleFloat(songTime);
|
||||
colorB.UpdateFlexibleFloat(songTime);
|
||||
colorA.UpdateFlexibleFloat(songTime);
|
||||
|
||||
if ((colorR.returnType is FlexibleReturnType.MiddleExecuting || colorR.isSwitchingReturnType) ||
|
||||
(colorG.returnType is FlexibleReturnType.MiddleExecuting || colorG.isSwitchingReturnType) ||
|
||||
(colorB.returnType is FlexibleReturnType.MiddleExecuting || colorB.isSwitchingReturnType) ||
|
||||
(colorA.returnType is FlexibleReturnType.MiddleExecuting || colorA.isSwitchingReturnType))
|
||||
{
|
||||
animationReturnType = FlexibleReturnType.MiddleExecuting;
|
||||
Color color = new Color(colorR.value, colorG.value, colorB.value, colorA.value);
|
||||
((Track)animatedObject).trackRendererSubmodule.meshGenerator.color = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
animationReturnType = FlexibleReturnType.MiddleInterval;
|
||||
}
|
||||
}
|
||||
public override void ApplyTimeOffset(float offset)
|
||||
{
|
||||
base.ApplyTimeOffset(offset);
|
||||
foreach (var item in colorR.animations) item.ApplyTimeOffset(offset);
|
||||
foreach (var item in colorG.animations) item.ApplyTimeOffset(offset);
|
||||
foreach (var item in colorB.animations) item.ApplyTimeOffset(offset);
|
||||
foreach (var item in colorA.animations) item.ApplyTimeOffset(offset);
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
base.Refresh();
|
||||
if (colorR.animations.Count == 0 && colorG.animations.Count == 0 && colorB.animations.Count == 0 && colorA.animations.Count == 0)
|
||||
{
|
||||
((Track)animatedObject).trackRendererSubmodule.meshGenerator.color = Color.white;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateAnimation(GameManager.instance.songTime);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new Beatmap.TrackGlobalColorChange_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
|
||||
colorR.ConvertToBM(), colorG.ConvertToBM(), colorB.ConvertToBM(), colorA.ConvertToBM());
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Ichni.RhythmGame.Beatmap
|
||||
{
|
||||
public class TrackGlobalColorChange_BM : AnimationBase_BM
|
||||
{
|
||||
public FlexibleFloat_BM colorR, colorG, colorB, colorA;
|
||||
|
||||
public TrackGlobalColorChange_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public TrackGlobalColorChange_BM(string elementName, Guid elementGuid, List<string> tags,
|
||||
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;
|
||||
this.colorB = colorB;
|
||||
this.colorA = colorA;
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = TrackGlobalColorChange.GenerateElement(elementName, elementGuid, tags, false, GetElement(attachedElementGuid),
|
||||
colorR.ConvertToGameType(), colorG.ConvertToGameType(), colorB.ConvertToGameType(), colorA.ConvertToGameType());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b3a4a2e6d3464840b6f1f076f41eda6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -163,7 +163,6 @@ namespace Ichni.RhythmGame
|
||||
GameManager.instance.beatmapContainer.gameElementList.ForEach(gameElement =>
|
||||
{
|
||||
gameElement.AfterInitialize();
|
||||
gameElement.Refresh();
|
||||
});
|
||||
|
||||
GameManager.instance.noteManager.AllNotesRegistered();
|
||||
|
||||
@@ -90,6 +90,8 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
colorSource.UpdateColor(false);
|
||||
}
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public virtual void WhenStart()
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Ichni.RhythmGame
|
||||
public GameObject perfectPoint;
|
||||
|
||||
public List<GameObject> notePartList;
|
||||
public List<GameObject> extraPartList;
|
||||
public List<GameObject> effectPrefabList;
|
||||
public virtual Vector3 noteVisualPosition => noteMain.transform.position;
|
||||
public EffectSubmodule effectSubmodule { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user