23 lines
741 B
C#
23 lines
741 B
C#
using Cielonos.MainGame.Characters;
|
|
using UniRx;
|
|
using UnityEngine;
|
|
|
|
namespace Cielonos.MainGame.Characters
|
|
{
|
|
public class SelfTimeSubmodule : SubmoduleBase<CharacterBase>
|
|
{
|
|
public FloatReactiveProperty timeScaleCoefficient;
|
|
public float TimeScale => timeScaleCoefficient.Value * Time.timeScale;
|
|
public float DeltaTime => timeScaleCoefficient.Value * Time.deltaTime;
|
|
|
|
public SelfTimeSubmodule(CharacterBase entity) : base(entity)
|
|
{
|
|
timeScaleCoefficient = new FloatReactiveProperty(1);
|
|
if (entity.animationSc.animator != null)
|
|
{
|
|
timeScaleCoefficient.Subscribe(x => { entity.animationSc.animator.speed = x; });
|
|
}
|
|
}
|
|
}
|
|
}
|