SwapBtn.cs 523 B

1234567891011121314151617181920212223242526272829303132
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System.Collections;
  4. public class SwapBtn : MonoBehaviour
  5. {
  6. public Image lightImage;
  7. private Craft craft;
  8. public void SetCraft(Craft craft)
  9. {
  10. this.craft = craft;
  11. FixedUpdate () ;
  12. }
  13. void FixedUpdate ()
  14. {
  15. if(craft != null)
  16. {
  17. if(craft.GetSwapManager().isPreparingSwap || !craft.IsLeaveDamage())
  18. {
  19. lightImage.fillAmount = 0;
  20. }
  21. else
  22. {
  23. lightImage.fillAmount = craft.GetSwapManager().GetSwapCoolDown() / SwapManager.SWAP_CD;
  24. }
  25. }
  26. }
  27. }