Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 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);
     }
 }