void SwitchToIdle() { sprite.SetTrigger("idle"); state = MercuryState.IDLE; if (halfway) { } }
void SwitchToDying() { //aS.clip = dying; //aS.Play(); SfxManager.instance.PlaySFX(dying, true); state = MercuryState.DYING; foreach (SpinningRing r in FindObjectsOfType <SpinningRing>()) { r.End(); } }
void SwitchToAngry() { sprite.SetTrigger("angry"); state = MercuryState.ANGRY; GameManager.instance.AddTimer(1, MakeCameraShake); GameManager.instance.AddTimer(2, SwitchToIdle); GameManager.instance.AddTimer(1f, AddSoundBlast); GameManager.instance.AddTimer(1.25f, AddSoundBlast); GameManager.instance.AddTimer(1.4f, AddSoundBlast); GameManager.instance.AddTimer(1.65f, AddSoundBlast); GameManager.instance.AddTimer(1.8f, AddSoundBlast); GameManager.instance.AddTimer(1.95f, AddSoundBlast); //aS.Play(); SfxManager.instance.PlaySFX(angry, true); }
void UpdateIdle() { int range = 2; if (halfway) { range = 3; } elapsedSinceLastAttack += Time.deltaTime * GameManager.instance.speed; if (elapsedSinceLastAttack > timeBetweenShots) { int r = Random.Range(0, range); switch (r) { case 0: // shoot fire missiles FireMissile(); GameManager.instance.AddTimer(0.25f, FireMissile); GameManager.instance.AddTimer(0.5f, FireMissile); GameManager.instance.AddTimer(0.75f, FireMissile); GameManager.instance.AddTimer(1f, FireMissile); GameManager.instance.AddTimer(1.25f, FireMissile); if (halfway) { GameManager.instance.AddTimer(1.5f, FireMissile); GameManager.instance.AddTimer(1.75f, FireMissile); GameManager.instance.AddTimer(2f, FireMissile); } break; case 1: // shoot bouncy fireball BouncyFire(); if (halfway) { GameManager.instance.AddTimer(1.75f, BouncyFire); } break; case 2: // big ol splosion BigSplosion(); if (halfway) { /*GameManager.instance.AddTimer(0.5f, BigSplosion); * GameManager.instance.AddTimer(.75f, BigSplosion); * GameManager.instance.AddTimer(1f, BigSplosion);*/ } break; } state = MercuryState.ATTACK1; sprite.SetTrigger("attack"); GameManager.instance.AddTimer(2.5f, ResetAttackTime); int rand = Random.Range(1, 11); if (rand > 4) { /*aS.Stop(); * aS.clip = attack; * aS.Play();*/ SfxManager.instance.PlaySFX(attack); } } if (!halfway) { float diff = GetComponent <Damageable>().maxHealth - GetComponent <Damageable>().currentHealth; if (diff >= GetComponent <Damageable>().maxHealth * 0.5f) { halfway = true; timeBetweenShots = timeBetweenShots * 0.8f; SwitchToAngry(); GameManager.instance.AddTimer(2, SwitchToIdle); } } if (GetComponent <Damageable>().died) { GameManager.instance.AddTimer(1, StartFalling); SwitchToDying(); sprite.SetTrigger("sad"); GetComponent <ContactDamager>().enabled = false; GameManager.instance.AddTimer(0f, AddSoundBlast); GameManager.instance.AddTimer(0.25f, AddSoundBlast); GameManager.instance.AddTimer(0.4f, AddSoundBlast); GameManager.instance.AddTimer(0.65f, AddSoundBlast); GameManager.instance.AddTimer(0.8f, AddSoundBlast); GameManager.instance.AddTimer(0.95f, AddSoundBlast); // add explosions here? } }
private void ResetAttackTime() { elapsedSinceLastAttack = 0; state = MercuryState.IDLE; }