77 lines
2.6 KiB
C#
77 lines
2.6 KiB
C#
|
|
using System;
|
||
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using Ichni.RhythmGame.Beatmap;
|
||
|
|
using Sirenix.OdinInspector;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
namespace Ichni.RhythmGame
|
||
|
|
{
|
||
|
|
public partial class TimeEffectsCollection : GameElement, IHaveEffectSubmodule
|
||
|
|
{
|
||
|
|
public EffectSubmodule effectSubmodule { get; set; }
|
||
|
|
public float time; //触发效果的时间
|
||
|
|
|
||
|
|
public static TimeEffectsCollection GenerateElement(string name, Guid guid, List<string> tags,
|
||
|
|
bool isFirstGenerated, GameElement parentElement, float time)
|
||
|
|
{
|
||
|
|
TimeEffectsCollection timeEffectsCollection = Instantiate(GameManager.instance.basePrefabs.emptyObject).AddComponent<TimeEffectsCollection>();
|
||
|
|
timeEffectsCollection.Initialize(name, guid, tags, isFirstGenerated, parentElement);
|
||
|
|
timeEffectsCollection.time = time;
|
||
|
|
return timeEffectsCollection;
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void SetDefaultSubmodules()
|
||
|
|
{
|
||
|
|
effectSubmodule = new EffectSubmodule(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
private void Update()
|
||
|
|
{
|
||
|
|
effectSubmodule.effectCollection["Prior"].ForEach(effect => effect.UpdateEffect(time));
|
||
|
|
effectSubmodule.effectCollection["Default"].ForEach(effect => effect.UpdateEffect(time));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public partial class TimeEffectsCollection
|
||
|
|
{
|
||
|
|
public override void SaveBM()
|
||
|
|
{
|
||
|
|
matchedBM = new TimeEffectsCollection_BM(elementName, elementGuid, tags,
|
||
|
|
parentElement.matchedBM as GameElement_BM, this);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
namespace Beatmap
|
||
|
|
{
|
||
|
|
public class TimeEffectsCollection_BM : GameElement_BM
|
||
|
|
{
|
||
|
|
public float time;
|
||
|
|
|
||
|
|
public TimeEffectsCollection_BM()
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
public TimeEffectsCollection_BM(string elementName, Guid elementGuid, List<string> tags,
|
||
|
|
GameElement_BM attachedElement, TimeEffectsCollection timeEffectsCollection)
|
||
|
|
: base(elementName, elementGuid, tags, attachedElement)
|
||
|
|
{
|
||
|
|
time = timeEffectsCollection.time;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
public override void ExecuteBM()
|
||
|
|
{
|
||
|
|
matchedElement = TimeEffectsCollection.GenerateElement(elementName, elementGuid,
|
||
|
|
tags, false, GetElement(attachedElementGuid), time);
|
||
|
|
}
|
||
|
|
|
||
|
|
public override GameElement DuplicateBM(GameElement attached)
|
||
|
|
{
|
||
|
|
return TimeEffectsCollection.GenerateElement(elementName, elementGuid,
|
||
|
|
tags, false, attached, time);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|