public void WasShot() { if (Fuels > 0) { tmpV3 = transform.position; tmpV3.x += Random.Range(-ScatterX, ScatterX); tmpV3.y -= Random.Range(0.01f, ScatterY); FuelPickup.Spawn(System.Guid.NewGuid().ToString(), tmpV3); Fuels--; Soundboard.Play(AUDIO_MINE); if (Fuels == 0) { gameObject.SetActive(false); } } }
private void HandleShooting() { if (bulletTimerCurrent <= 0) { if (Input.GetButtonDown(FIRE_BUTTON)) { bulletTimerCurrent = BulletTimer; Bullet.Spawn(transform.position + new Vector3(_c.offset.x + (Facing.X * BulletOffset), _c.offset.y + (Facing.Y * BulletOffset) + 0.2f, 0), Facing.ToVector2(), BulletLifetime, BulletSpeed); GameState.SpendFuel(BulletCost); Soundboard.Play(AUDIO_SHOOT); } } else { bulletTimerCurrent -= Time.deltaTime; } }
public static void GainFuel(float amount) { Fuel += amount; Soundboard.Play(AUDIO_FUEL); }