OldBlueWater/BlueWater/Assets/02.Scripts/Character/CombatPlayer2D/CombatStatus.cs
NTG 7a2b5e9d02 Closes #255 거대 슬라임 보스 추가
+ UiManager의 CombatUi, OceanUi 모두 분리
각각의 씬에서 CombatUiManager, OceanUiManager로 변경
+ Ocean, OceanUi input action map 추가 및 변경
input action map, uiManager 변경에 따른 Player input 로직 변경
+ CombatPlayer가 죽으면 GameOverUi 추가
+ 재시작 기능 추가
+ 인벤토리 Ui 수정
+ 슬라임 보스 로직 및 애니메이션 수정
2024-05-12 06:29:16 +09:00

50 lines
1.5 KiB
C#

using UnityEngine;
// ReSharper disable once CheckNamespace
namespace BlueWaterProject
{
public class CombatStatus : MonoBehaviour
{
[field: SerializeField] public bool IsStunned { get; private set; }
[field: SerializeField] public bool IsSlowedMoveSpeed { get; private set; }
[field: SerializeField] public float MoveSpeedCoefficient { get; private set; }
private Coroutine stunCoolDownCoroutine;
private Coroutine slowMoveSpeedCoolDownCoroutine;
public void Stun(float duration)
{
IsStunned = true;
if (stunCoolDownCoroutine != null)
{
StopCoroutine(stunCoolDownCoroutine);
}
stunCoolDownCoroutine = StartCoroutine(Utils.CoolDown(duration, EndStun));
}
private void EndStun()
{
IsStunned = false;
stunCoolDownCoroutine = null;
}
public void SlowMoveSpeed(float duration, float moveSpeedCoefficient)
{
IsSlowedMoveSpeed = true;
MoveSpeedCoefficient = moveSpeedCoefficient;
if (slowMoveSpeedCoolDownCoroutine != null)
{
StopCoroutine(slowMoveSpeedCoolDownCoroutine);
}
slowMoveSpeedCoolDownCoroutine = StartCoroutine(Utils.CoolDown(duration, EndSlowMoveSpeed));
}
private void EndSlowMoveSpeed()
{
IsSlowedMoveSpeed = false;
slowMoveSpeedCoolDownCoroutine = null;
}
}
}