public void Die(float vibDuration = 1.0f, float vibStrength = 2.0f) { AkSoundEngine.PostEvent("Play_Death", gameObject); VibrationManager.AddVibrateRight(vibStrength, vibDuration); if ((swarm.ShrinkUnits + swarm.units.Count) > 1) { if (swarm.ShrinkUnits > 0) { swarm.ShrinkUnits--; } else { swarm.units[0].Die(); } } else { swarm.ShrinkUnits = 0; swarm.units.Clear(); Destroy(gameObject); } ScoreManager.nbPyuKilled++; }
public void Die(float vibDuration = 1.0f, float vibStrength = 2.0f) { AkSoundEngine.PostEvent("Play_Death", gameObject); Debug.Log("Killed"); Debug.Log(this.gameObject); VibrationManager.AddVibrateLeft(vibStrength, vibDuration); Destroy(gameObject); ScoreManager.nbPyuKilled++; }
void lowerPV() { pv--; VibrationManager.AddVibrateRight(vibStrength, vibDuration); AkSoundEngine.PostEvent("Play_CoeurHit", gameObject); if (pv <= 0) { //stop pyus from colliding with boss when dead Collider2D bossColl = GetComponent <Collider2D>(); bossColl.enabled = false; foreach (partController part in parts) { Collider2D pColl = part.GetComponent <Collider2D>(); pColl.enabled = false; } bossExpl.SetTrigger("explode"); isDying = true; dieStartTime = Time.time; dieDuration = 1f; Invoke("End", 2.0f); //Spawn a item that when hit, brings you to win screen GameObject goec = Instantiate(endCristalPrefab, new Vector3(0.0f, 0.0f, 0.0f), Quaternion.identity, transform); //Add tuto part EndCristal ec = goec.transform.GetComponent <EndCristal>(); ec.tutorial = Tutorial; //Destroy(this.gameObject); } else { //INSERER SON DEGAT SUR BOSS } }
private void Awake() { _vm = this; }