本文共 1180 字,大约阅读时间需要 3 分钟。
public skillPostion Postion;private Image image;private Image clodImage;public float coldeTimer;private float timer = 0;private bool iscold = false;void Awake(){ if (Postion==skillPostion.One|| Postion == skillPostion.Two||Postion == skillPostion.Three) { image = this.transform.GetComponent(); clodImage = this.transform.Find("coldimage").GetComponent(); clodImage.fillAmount = 1; clodImage.enabled = false; } }// Update is called once per framevoid Update () { if (iscold) { if (clodImage.enabled==false) { clodImage.enabled = true; } image.raycastTarget = false; timer += Time.deltaTime; clodImage.fillAmount = (coldeTimer-timer) / coldeTimer; if (timer>=coldeTimer) { timer = 0; clodImage.fillAmount = 1; image.raycastTarget = true; iscold = false; } }}public void OnPointerDown(PointerEventData eventData){ if (Postion == skillPostion.One || Postion == skillPostion.Two || Postion == skillPostion.Three) { iscold = true; } teanscriptManager.intance.playerAnimation.playanimation(Postion);}
转载地址:http://vbrxo.baihongyu.com/