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(); } }
public bool PlayCard(int cardIndex) { if (!energy.HasFullEnergy) { return(false); } Player.Instance.CmdCastSpell(cardIndex); energy.Consume(); CardSpawner.Instance.SpawnRandomCard(); return(true); }
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; }