Esempio n. 1
0
 public void Boost()
 {
     if (!isSlowingDown && energy.Consume(boostEnergyPerSecond * Time.deltaTime))
     {
         rigidbody.velocity = new Vector3(rigidbody.velocity.x, rigidbody.velocity.y, forwardSpeed * boostSpeedMultiplier);
         if (!boostSource.isPlaying)
         {
             boostSource.Play();
         }
     }
     else
     {
         boostSource.Stop();
     }
 }
Esempio n. 2
0
    public bool PlayCard(int cardIndex)
    {
        if (!energy.HasFullEnergy)
        {
            return(false);
        }

        Player.Instance.CmdCastSpell(cardIndex);
        energy.Consume();
        CardSpawner.Instance.SpawnRandomCard();

        return(true);
    }
Esempio n. 3
0
    void LateUpdate()
    {
        if (isActivated && (energy == null || energy.Consume(energyCostPerSecond * Time.deltaTime)))
        {
            EmitLaser();
            if (source != null && !source.isPlaying)
            {
                source.Play();
            }
        }

        else
        {
            lineRenderer.SetPosition(0, startPoint.position);
            lineRenderer.SetPosition(1, startPoint.position);
            if (source != null)
            {
                source.Stop();
            }
        }
        isActivated = false;
    }