private void KiteBehavior_OnStateChanged(object sender, KiteStates newState) { switch (newState) { case KiteStates.CaptureStar: if (this.soundManager != null) { this.soundManager.PlaySound(SoundManager.SOUNDS.Coin); } this.CurrentScore++; break; case KiteStates.Crash: if (this.soundManager != null) { this.soundManager.PlaySound(SoundManager.SOUNDS.Crash); } // Crash Effect this.crashEffectComponent .DoEffect(); //Dissable Scroll this.SetScrollEnable(false); break; case KiteStates.GameOver: this.SetState(GameplayStates.GameOver); break; default: break; } }
public void SetState(KiteStates state) { switch (state) { case KiteStates.TakeOff: this.speed = 0; this.transform2D.Y = WaveServices.ViewportManager.VirtualHeight / 2; break; case KiteStates.Gameplay: if (this.KiteState == KiteStates.Gameover) { this.transform2D.Y = WaveServices.ViewportManager.VirtualHeight / 2; } this.speed = TAPPOWER; break; case KiteStates.Gameover: this.soundManager.PlaySound(SoundManager.SOUNDS.Crash); this.scene.SetState(GameScene.GameSceneStates.Crash); break; default: break; } this.KiteState = state; }
public void SetState(KiteStates state) { var previousState = this.KiteState; switch (state) { case KiteStates.TakeOff: this.speed = 0; this.transform2D.Y = 180; break; case KiteStates.Gameplay: if (previousState == KiteStates.GameOver) { this.SetNewColor(); this.transform2D.Y = 180; } if (previousState == KiteStates.TakeOff || previousState == KiteStates.GameOver) { this.speed = TAPPOWER; } break; default: break; } this.KiteState = state; if (this.OnStateChanged != null) { this.OnStateChanged(this, this.KiteState); } }