private void Explosion() { //hide the train. StopAllCoroutines(); gameObject.transform.scale = Vector3.One; soundComponentTravel.Stop(); emitterThomasFace.EmitOneShot(1); emitterFire.EmitOneShot(40); emitterSpark.Emit = false; emitterSpark.EmitOneShot(200); soundComponentExplosion.Play(); StartCoroutine(KillTrain()); _DespawnTimer = 0.0f; }
private void UpdateState() { switch (State) { case CAM_STATE.MAIN_MENU: TurnOnLights(); if (!MenuSound.IsPlaying()) { MenuSound.Play(); } MainMenu.SetUpScene(); Camera.fixedAspectRatio = true; Camera.orthographic = true; MainMenu.Canvas.isRendering = true; break; case CAM_STATE.JOIN_HOST: TurnOnLights(); if (!MenuSound.IsPlaying()) { MenuSound.Play(); } MainMenu.SetUpScene(); Camera.fixedAspectRatio = true; Camera.orthographic = true; JoinHost.Canvas.isRendering = true; break; case CAM_STATE.SELECT_TEAM: TurnOnLights(); if (!MenuSound.IsPlaying()) { MenuSound.Play(); } SelectTeam.SetUpScene(); SelectTeam.Canvas.isRendering = true; Camera.fixedAspectRatio = false; Camera.orthographic = false; break; case CAM_STATE.GAME: if (MenuSound.IsPlaying()) { MenuSound.Stop(); } TurnOffLights(); Hud.Canvas.isRendering = true; if (GUIScoreboard.Instance) { GUIScoreboard.Instance.enabled = true; } break; case CAM_STATE.EXIT_MENU: TurnOffLights(); ExitMenu.Canvas.isRendering = true; break; case CAM_STATE.HOST_MENU: if (!MenuSound.IsPlaying()) { MenuSound.Play(); } TurnOnLights(); HostMenu.SetUpScene(); Camera.fixedAspectRatio = false; Camera.orthographic = false; HostMenu.Canvas.isRendering = true; break; case CAM_STATE.OPTIONS_MENU: OptionsMenu.Canvas.isRendering = true; break; case CAM_STATE.LOADING_SCREEN: TurnOffLights(); LoadingScreen.Canvas.isRendering = true; break; case CAM_STATE.SCORE_SCREEN: if (GUIScoreScreen.Instance) { GUIScoreScreen.Instance.enabled = true; GUIScoreScreen.Instance.Canvas.isRendering = true; } break; } }
public override void Cleanup() { base.Cleanup(); soundComponentChargeUp.Stop(); }
private IEnumerator BlastingMusic() { //List<ChadControls> affectedChads = new List<ChadControls>(); if (_Note1 && _Note2) { _Note1.Emit = true; _Note2.Emit = true; } if (GramophoneClip) { GramophoneClip.Play(); } // Start blasting ChadControls localChad = MatchSystem.instance.LocalChad; TEAM_TYPE playerTeam = MatchSystem.instance.GetPlayerTeam(ObjectOwner.gameObject); TEAM_TYPE otherPlayerTeam = MatchSystem.instance.GetPlayerTeam(localChad.gameObject); while (_Timer < _DanceDuration) { _Timer += Time.DeltaTime; if (localChad) { float distance = Vector3.Distance(localChad.transform.position, transform.position); if (distance < ExplosionRadius && localChad.State != ChadControls.STATE.RAGDOLL && localChad.State != ChadControls.STATE.DANCING) { localChad.Direction = Vector3.Zero; localChad.rBody.LinearVelocity = new Vector3(0, localChad.rBody.LinearVelocity.y, 0);; localChad.CurrentVelocity = Vector2.Zero; localChad.State = ChadControls.STATE.DANCING; ChadHud.Instance.DeactivateAimHUD(); localChad.ChargeTime = 0; //affectedChads.Add(localChad); } else if (distance > ExplosionRadius && localChad.State == ChadControls.STATE.DANCING) { //foreach (var player in affectedChads) //{ // if (player == localChad) // { // localChad.State = ChadControls.STATE.CHADING; // affectedChads.Remove(player); // buggy? // } //} localChad.State = ChadControls.STATE.CHADING; } } yield return(null); } GramophoneClip.Stop(); // Reset all dancing Chads, the party is over //foreach (var player in affectedChads) //{ // if (player == localChad && localChad.State == ChadControls.STATE.DANCING) // { // localChad.State = ChadControls.STATE.CHADING; // //affectedChads.Remove(player); // buggy? // } //} if (localChad.State == ChadControls.STATE.DANCING) { localChad.State = ChadControls.STATE.CHADING; } //affectedChads.Clear(); Explosion(); }