// Start is called before the first frame update void Start() { curPowerup = PlayerPowerup.None; originalReticleColor = reticleImage.color; reticleImage.gameObject.SetActive(waggleCollected > 0); ReticleEffect(); }
private void ActivateWaggleDance() { if (waggleCollected <= 0) { return; } bool didDance = false; if (curTarget != null) { if (curTarget.CompareTag("Enemy")) { // This currently just feels like a different version of the free sting... Debug.Log("here: " + curTarget.name); FindObjectOfType <StingBehavior>().FinishSting(1, 1, curTarget); didDance = true; } else if (curTarget.CompareTag("Collectible")) { CollectibleBehavior cb = curTarget.GetComponent <CollectibleBehavior>(); if (cb == null) { return; } if (cb.collectibleType == CollectibleType.Pollen) { cb.SendMessage("ControllerCollisionListener", new object[] { GetComponent <PlayerControl>(), 2 }); didDance = true; } } else if (curTarget.CompareTag("Hive")) { HiveManager hm = FindObjectOfType <HiveManager>(); hm.ActivateHiveDefence(); didDance = true; } } else { // Our third dance, Shock, isn't needed till level 3. I'm thinking this is some sort of AoE attack? // However, I don't know what the best way to trigger it would be, and if this `else` case is enough. // temp didDance = false; } if (didDance) { Instantiate(swarmVfx, curTarget.transform.position, Quaternion.identity); AudioSource.PlayClipAtPoint(danceMusic, transform.position, 1f); curPowerup = PlayerPowerup.WaggleDance; powerupTimeout = waggleDanceDuration; waggleCollected--; gui.UpdateGUI(PlayerPowerup.WaggleDance, waggleCollected); } }
// Update is called once per frame void Update() { if (curPowerup != PlayerPowerup.None) { powerupTimeout -= Time.deltaTime; if (powerupTimeout < 0) { curPowerup = PlayerPowerup.None; } } }
private void ActivateSting() { if (stingCollected <= 0) { return; } curPowerup = PlayerPowerup.FreeSting; powerupTimeout = 0; // Sting doesn't have an active duration, it's one-and-done. stingCollected--; gui.UpdateGUI(PlayerPowerup.FreeSting, stingCollected); }
private void ActivateVortex() { if (vortexCollected <= 0) { return; } curPowerup = PlayerPowerup.Vortex; powerupTimeout = vortexDuration; vortexCollected--; gui.UpdateGUI(PlayerPowerup.Vortex, vortexCollected); }
public void Activate(PlayerPowerup powerupType) { switch (powerupType) { case PlayerPowerup.Vortex: ActivateVortex(); break; case PlayerPowerup.FreeSting: ActivateSting(); break; case PlayerPowerup.WaggleDance: ActivateWaggleDance(); break; } }
public void GivePowerup(PlayerPowerup powerupType) { switch (powerupType) { case PlayerPowerup.Vortex: vortexCollected++; gui.UpdateGUI(powerupType, vortexCollected); break; case PlayerPowerup.FreeSting: stingCollected++; gui.UpdateGUI(powerupType, stingCollected); break; case PlayerPowerup.WaggleDance: waggleCollected++; reticleImage.gameObject.SetActive(true); gui.UpdateGUI(powerupType, waggleCollected); break; } }