58 lines
1.3 KiB
C#
58 lines
1.3 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class CoolDownEagle : MonoBehaviour
|
|
{
|
|
public enum Type
|
|
{
|
|
Falcon = 0,
|
|
Eagle = 1
|
|
}
|
|
|
|
public Type type;
|
|
|
|
public Sprite[] typeIcons;
|
|
|
|
public Image iconType;
|
|
|
|
public Text valueText;
|
|
|
|
private void Start()
|
|
{
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
GameManager.Instance._playerData.eagleEyesCoolDown = Mathf.MoveTowards(GameManager.Instance._playerData.eagleEyesCoolDown, 0f, Time.unscaledDeltaTime);
|
|
int minutes = TimeSpan.FromSeconds(GameManager.Instance._playerData.eagleEyesCoolDown).Minutes;
|
|
int seconds = TimeSpan.FromSeconds(GameManager.Instance._playerData.eagleEyesCoolDown).Seconds;
|
|
valueText.text = minutes + ":" + seconds.ToString("00");
|
|
if (GameManager.Instance._playerData.eagleEyesCoolDown == 0f)
|
|
{
|
|
UnityEngine.Object.Destroy(base.gameObject);
|
|
}
|
|
}
|
|
|
|
public void StartCooldown(Type mType)
|
|
{
|
|
type = mType;
|
|
iconType.sprite = typeIcons[(int)mType];
|
|
switch (mType)
|
|
{
|
|
case Type.Eagle:
|
|
if (GameManager.Instance._playerData.eagleEyesCoolDown == 0f)
|
|
{
|
|
GameManager.Instance._playerData.eagleEyesCoolDown = 240f;
|
|
}
|
|
break;
|
|
case Type.Falcon:
|
|
if (GameManager.Instance._playerData.eagleEyesCoolDown == 0f)
|
|
{
|
|
GameManager.Instance._playerData.eagleEyesCoolDown = 120f;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|