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);
         }
     }
 }
        void Update()
        {
            material.mainTextureOffset += offsetRate * Time.deltaTime;
            material.mainTextureScale  += scaleRate * Time.deltaTime;

            if (changeTimer != null && changeTimer.Use())
            {
                curTexture           = (curTexture + 1) % textures.Length;
                material.mainTexture = textures[curTexture];
                material.SetTexture("_EmissionMap", textures[curTexture]);
            }
        }