36 lines
928 B
C#
36 lines
928 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
using DG.Tweening;
|
||
|
using Sirenix.OdinInspector;
|
||
|
|
||
|
/// <summary>
|
||
|
/// 控制镰刀CDUI的脚本
|
||
|
/// </summary>
|
||
|
public class SickleCD : MonoBehaviour
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 镰刀CD总时长,初始化的时候从玩家获取
|
||
|
/// </summary>
|
||
|
private float allTime;
|
||
|
private MyPlayer player;
|
||
|
private Image image;
|
||
|
void Start(){
|
||
|
player = FindObjectOfType<MyPlayer>();
|
||
|
allTime = player.sickleCD;
|
||
|
image = GetComponent<Image>();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 玩家发射镰刀的时候顺便触发,开始计算镰刀UI
|
||
|
/// </summary>
|
||
|
public void OnSickle(){
|
||
|
//先让标志shake一下,很酷
|
||
|
transform.parent.DOShakePosition(0.5f,10);
|
||
|
//再开始Tween填充
|
||
|
image.fillAmount = 0;
|
||
|
image.DOFillAmount(1,allTime).SetEase(Ease.Linear);
|
||
|
}
|
||
|
}
|