private IEnumerator PlayDeathAnimation() { onDeathExplosion.TurnOnExplosions(); yield return(new WaitForSeconds(transitionOutFlashAmount)); onDeathExplosion.TurnOffExplosions(); BossPhaseThree newBossPhase = Instantiate(bossPhaseThreePrefab, transform.position, transform.rotation); Destroy(gameObject); }
// Use this for initialization void Start() { if (instance == null) { instance = this; } else { Destroy(gameObject); } myRGB2D = gameObject.GetComponent <Rigidbody2D>(); hitBox = gameObject.GetComponent <Collider2D>(); player = FindObjectOfType <Player>(); lastMoveTime = timeBetweenMoves; reachedDestination = true; myColorFlash = gameObject.GetComponent <ColorFlash>(); flashInTimePlayed = transitionInFlashAmount; flashOutTimePlayed = transitionOutFlashAmount; lastFlashTime = timeBetweenFlashes; isDead = false; }