void Update() { chargeTimer += Time.deltaTime; if (!enemyHealth.IsDead() && !playerHealth.IsDead()) { if (actionState == ActionState.Chasing) { ChasePlayer(); } else if (actionState == ActionState.Charging) { ChargeToPlayer(); } else if (actionState == ActionState.ChargePreparation) { // Do nothing } } else { // Enemy or Player dead nav.enabled = false; dustCloud.Stop(); if (playerHealth.IsDead()) { anim.SetTrigger("PlayerDead"); TurnNormal(); enemyAttackAudioSource.FadeOut(); } } dustCloud.transform.rotation = dustCloudRotation; // Retain rotation (don't rotate with parent) }
private void StopApplyingThrust() { audioSource.FadeOut(); isThrusting = false; if (thrustParticles.isPlaying) { StartCoroutine(StopParticleSystem(thrustParticles)); } }
private void PlayColorSound() { if (powerColor == PowerColor.GREEN) { greenAudio.FadeIn(); } else { greenAudio.FadeOut(); } }
// Update is called once per frame void Update() { var fire1Down = CrossPlatformInputManager.GetButtonDown("Fire1"); if (fire1Down) { lazerParticles.ForEach(lp => lp.Play()); audioSource.PlayOneShot(lazerSound); } var fire1up = CrossPlatformInputManager.GetButtonUp("Fire1"); if (fire1up && audioSource.IsPlaying) { audioSource.FadeOut(); } }
// WIP / broken: // private Vector2 slimeSoccerUp = new Vector2(0, 10); // private Vector2 slimeSoccerDown = new Vector2(0, -10); // Return to normal. public void StopRandomEvent() { Debug.Log("stoprandomevent"); // Apply normal gravity. m_ballManager.AntiGravBalls(); if(m_gravity == m_strongLeft) { gravEffectLeft.GetComponent<GravityEffectController>().EffectOff (); Debug.Log ("Turning off"); } else { gravEffectRight.GetComponent<GravityEffectController>().EffectOff (); } Physics2D.gravity = new Vector2(0f, 0f); m_gravitySound.FadeOut(); m_running = false; }
public void ScaleDown() { transform.GetChild(0).GetComponent <CircleCollider2D>().enabled = false; _scalingMode = ScalingMode.ScaleDown; _loopingSound.FadeOut(); }