예제 #1
0
 private bool CanPlay()
 {
     if (playCooldown == 0)
     {
         return(true);
     }
     else if (string.IsNullOrEmpty(cooldownId))
     {
         if (playTimer == null)
         {
             playTimer = new CooldownTimer(playCooldown, 0);
         }
         return(playTimer.Use());
     }
     else
     {
         if (!lastPlayTimes.ContainsKey(cooldownId) || Time.time - lastPlayTimes[cooldownId] > playCooldown)
         {
             lastPlayTimes[cooldownId] = Time.time;
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
예제 #2
0
        protected virtual void Awake()
        {
            hitInvulnTimer   = new CooldownTimer(hitInvuln, 0);
            healthRegenTimer = new ExpirationTimer(healthRegenDelay);

            ResetHealth();
        }
 void Start()
 {
     material = GetComponent <MeshRenderer>().material;
     if (HasTextureAnimation())
     {
         changeTimer = new CooldownTimer(1.0f / framerate);
     }
 }