30 lines
824 B
C#
30 lines
824 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Slow : Status
|
|
{
|
|
private float _speedModifier;
|
|
|
|
public override void Apply(float duration)
|
|
{
|
|
_duration += duration;
|
|
EntityLinked.SpeedStatusModifier *= _speedModifier;
|
|
}
|
|
|
|
public override void Unapply()
|
|
{
|
|
EntityLinked.SpeedStatusModifier /= _speedModifier;
|
|
Destroy(this);
|
|
}
|
|
|
|
/// <summary>
|
|
/// A higher intensity results in a stronger slow.
|
|
/// Example: An intensity of 0.99 multiplies the entity's speed by 0.01 (which would result in a really low speed)
|
|
/// </summary>
|
|
public float Intensity {
|
|
get => 1 - _speedModifier;
|
|
set => _speedModifier = _speedModifier == 0 ? 1 - value : _speedModifier + (1 - _speedModifier) * value;
|
|
}
|
|
}
|