void Update() { #region MODE_CHANGING if (Input.GetKeyDown(KeyCode.T)) { if (currentState == ModeState.KINEMATIC) { currentState = ModeState.STEERING; modeText.text = "Steering"; } else { currentState = ModeState.KINEMATIC; modeText.text = "Kinematic"; } } #endregion // Tag changing and unfreezing to allow the game to continue when no more freezable characters exist #region UNFREEZING_FOR_CONTINUED_GAME if (numNotFrozenExceptTagged == 0 && lastFrozenCharacter) { lastFrozenCharacter.tag = "Tagged Player"; lastFrozenCharacter.transform.position = new Vector3(0.0f, lastFrozenCharacter.transform.position.y, 5.0f); lastTaggedCharacter.transform.position = new Vector3(0.0f, lastTaggedCharacter.transform.position.y, -5.0f); lastFrozenCharacter.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.None; lastTaggedCharacter.tag = "Not Frozen"; lastTaggedCharacter.GetComponent <Seek>().target = null; lastTaggedCharacter.GetComponent <SteeringSeek>().target = null; numNotFrozenExceptTagged = 1; lastFrozenCharacter = null; lastTaggedCharacter = null; } #endregion }
/// <summary> Установить заданный режим в качестве активного </summary> public void Set(ResourceDictionary dictionary) { Steps = new ModeStepList(dictionary, OnAnimationStop); State = new ModeState(Steps); SetAll(true); UpdateStepState(); }
public MainModel() { mKinect = KinectDevice.Instance; mWindow = (MainWindow)System.Windows.Application.Current.MainWindow; //mVoiceControl = VoiceControl.Instance(); speechRecognizer = SpeechRecognizer.Create(); //returns null if problem with speech prereqs or instantiation. if (speechRecognizer != null) { speechRecognizer.Start(new KinectAudioSource()); //KinectSDK TODO: expose Runtime.AudioSource to return correct audiosource. speechRecognizer.SaidSomething += new EventHandler <SpeechRecognizer.SaidSomethingEventArgs>(recognizer_SaidSomething); } mSkeleton = mKinect.mSkeleton; mGraphPlot = mWindow.theGraphPlot.vm; mCurrentModeState = ModeState.TrackingMode; mWindow.IndicatorPan.TrackingButton.IsChecked = true; UpdateMode((int)ModeState.TrackingMode); mSelectedJoint = "Head"; ChangeCurrentJoint(mSelectedJoint); mLineGraphing = new LineGraphing(); mParabolaGraphing = new ParabolaGraphing(); mSineGraphing = new SineGraphing(); mAllowLineEdit = false; mAllowParabolaEdit = false; mAllowSineEdit = false; mRandom = new Random(); }
void Awake() { b = GameObject.Find("blinky").GetComponent <GhostMove>(); p = GameObject.Find("pinky").GetComponent <GhostMove>(); i = GameObject.Find("inky").GetComponent <GhostMove>(); c = GameObject.Find("clyde").GetComponent <GhostMove>(); resetMachine = false; blinder = GameObject.Find("blackout"); confuse = GameObject.Find("confuse"); MainCam = GameObject.Find("Main Camera").GetComponent <Camera>(); r = MainCam.GetComponent <Rotate>(); modeState = ModeState.Norm; if (_instance == null) { _instance = this; DontDestroyOnLoad(this); } else { if (this != _instance) { Destroy(this.gameObject); } } }
public override void Loop(float frameSecs) { if (localPlayerJoined && !bikesCreated) { logger.Info($"{this.ModeName()}: Loop() Creating bikes!"); string cameraTargetBikeId = CreateADemoBike(); for (int i = 1; i < kSplashBikeCount; i++) { CreateADemoBike(); } // Note that the target bike is probably NOT created yet at this point. // This robably needs to happen differently game.frontend?.OnStartMode(BeamModeFactory.kSplash, new TargetIdParams { targetId = cameraTargetBikeId }); bikesCreated = true; _CurrentState = ModeState.Playing; } if (bikesCreated) { _secsToNextRespawnCheck -= frameSecs; if (_secsToNextRespawnCheck <= 0) { // TODO: respawn with prev names/teams? if (game.CoreData.Bikes.Count() < kSplashBikeCount) { CreateADemoBike(); } _secsToNextRespawnCheck = kRespawnCheckInterval; } } }
private void UpdateMode(ModeState modeState) { if (modeState == ModeState.BRIDGE) { this.bridgeBehavior.IsActive = true; this.stackBehavior.IsActive = false; this.emiterBehavior.IsActive = false; this.stackBehavior.RemoveWall(); this.emiterBehavior.ResetEmiter(); } else if (modeState == ModeState.EMITER) { this.emiterBehavior.IsActive = true; this.bridgeBehavior.IsActive = false; this.stackBehavior.IsActive = false; this.stackBehavior.RemoveWall(); this.bridgeBehavior.Reset(); } else if (modeState == ModeState.WALL) { this.stackBehavior.IsActive = true; this.bridgeBehavior.IsActive = false; this.emiterBehavior.IsActive = false; this.emiterBehavior.ResetEmiter(); this.bridgeBehavior.Reset(); } }
// Use this for initialization void Start() { moveState = GetComponent<MoveState>(); modeState = GetComponent<ModeState>(); booster = GetComponent<Booster>(); neutral = GetComponent<Neutral>(); rigidbody = GetComponent<Rigidbody>(); rigidbody.velocity = Vector3.forward * 1.0f; }
IEnumerator Blind() { blinder.SetActive(true); yield return(new WaitForSeconds(modeTime)); modeState = ModeState.Norm; StartMode(); yield break; }
public void PauseGame() { state = ModeState.Pause; Time.timeScale = 0; Debug.Log("PauseGame "); //MusicPlayer.instance.StopFirstSound(); }
IEnumerator Rotate() { r.rotate = true; yield return(new WaitForSeconds(modeTime)); modeState = ModeState.Norm; StartMode(); yield break; }
protected override void Update(TimeSpan gameTime) { inputService = WaveServices.Input; if (inputService.KeyboardState.IsConnected) { // Key F1 if (inputService.KeyboardState.F1 == ButtonState.Pressed && beforeKeyboardState.F1 != ButtonState.Pressed) { this.diagnostics = !this.diagnostics; WaveServices.ScreenContextManager.SetDiagnosticsActive(this.diagnostics); this.Owner.Scene.RenderManager.DebugLines = this.diagnostics; } // Key F5 else if (this.modeState != ModeState.EMITER && inputService.KeyboardState.F5 == ButtonState.Pressed && beforeKeyboardState.F5 != ButtonState.Pressed) { this.modeState = ModeState.EMITER; this.UpdateMode(this.modeState); } // Key F6 else if (this.modeState != ModeState.WALL && inputService.KeyboardState.F6 == ButtonState.Pressed && beforeKeyboardState.F6 != ButtonState.Pressed) { this.modeState = ModeState.WALL; this.UpdateMode(this.modeState); } // Key F7 else if (this.modeState != ModeState.BRIDGE && inputService.KeyboardState.F7 == ButtonState.Pressed && beforeKeyboardState.F7 != ButtonState.Pressed) { this.modeState = ModeState.BRIDGE; this.UpdateMode(this.modeState); } // Key G else if (inputService.KeyboardState.G == ButtonState.Pressed && beforeKeyboardState.G != ButtonState.Pressed) { gravityIndex++; this.Owner.Scene.PhysicsManager.Gravity3D = gravities[gravityIndex % gravities.Length]; } // Key H else if (inputService.KeyboardState.H == ButtonState.Pressed && beforeKeyboardState.H != ButtonState.Pressed) { MyScene scene = this.Owner.Scene as MyScene; scene.helpText.Entity.Enabled = !scene.helpText.Entity.Enabled; } } beforeKeyboardState = inputService.KeyboardState; }
// Update is called once per frame void Update() { if (resetMachine) { resetMachine = false; StopAllCoroutines(); modeState = ModeState.Norm; StartMode(); } }
protected override void DefaultValues() { base.DefaultValues(); this.diagnostics = false; this.modeState = ModeState.EMITER; this.gravityIndex = 0; this.gravities = new Vector3[] { new Vector3(0,-120,0), new Vector3(120,0,0), new Vector3(-120,0,0), new Vector3(0,120,0)}; }
IEnumerator Normal() { yield return(ReturnToNormalState()); yield return(new WaitForSeconds(5f)); modeState = RandomEnumValue <ModeState>(); Debug.Log(modeState); StartMode(); yield break; }
protected override void DefaultValues() { base.DefaultValues(); this.diagnostics = false; this.modeState = ModeState.EMITER; this.gravityIndex = 0; this.gravities = new Vector3[] { new Vector3(0, -120, 0), new Vector3(120, 0, 0), new Vector3(-120, 0, 0), new Vector3(0, 120, 0) }; }
public Mode GetMode(ModeState state) { foreach (Mode mode in modes) { if (mode.state == state) { return(mode); } } return(null); }
IEnumerator Reverse() { confuse.SetActive(true); yield return(new WaitForSeconds(0.5f)); reverseMode = true; yield return(new WaitForSeconds(modeTime)); modeState = ModeState.Norm; StartMode(); yield break; }
IEnumerator Speedo() { b.speed = 0.16f; p.speed = 0.16f; i.speed = 0.16f; c.speed = 0.16f; yield return(new WaitForSeconds(modeTime)); modeState = ModeState.Norm; StartMode(); yield break; }
public void ContinueGame() { Debug.Log("ContinueGame "); state = ModeState.Play; Time.timeScale = 1; //if (!SaveLoad.GetInstance().pData.musicMute) //{ // MusicPlayer.instance.StopFirstSound(); // MusicPlayer.instance.PlayFirstSound(); //} }
// Initialize possible players void Awake() { int TaggedPlayer = Random.Range(1, players.Length); players[TaggedPlayer - 1].tag = "Tagged Player"; if (!modeText) { modeText = GameObject.Find("CurrentMode").GetComponent <Text>(); } // Default state is KINEMATIC movement currentState = ModeState.KINEMATIC; }
IEnumerator Close() { while (MainCam.orthographicSize > 6) { MainCam.orthographicSize -= 4f * Time.deltaTime; yield return(null); } yield return(new WaitForSeconds(modeTime)); modeState = ModeState.Norm; StartMode(); yield break; }
public override void Start(object param = null) { logger.Info("Starting Splash"); base.Start(); appl.PeerJoinedGameEvt += OnPeerJoinedGameEvt; appl.AddAppCore(null); // TODO: THis is beam only. Need better way. ClearGameInstances()? Init()? // Setup/connect fake network appl.ConnectToNetwork("p2ploopback"); appl.JoinNetworkGame(GameName); _CurrentState = ModeState.JoiningGame; // Now wait for OnPeerJoinedGame() }
public void SetMode(ModeState state) { if (currentMode != null) { StartCoroutine(AnimateModeAlpha(currentMode, 0, animationOutTime, 0)); } if (state == ModeState.None) { return; } currentMode = GetMode(state); StartCoroutine(AnimateModeAlpha(currentMode, 1, animationInTime, animationOutTime)); }
private void Initialize() { // We are starting up for the first time. _modeState = new ModePowerUpState(this); _door = new Door(this); // The initial configuration setting for the // device. This initial configuration can come // from an external configuration file, for // example. _configurationState = new ProductionState(this); // The door is initially closed _door.DoorState = new DoorClosedState(_door); // We are ready _modeState.SetModeToIdle(); }
public Player(BuildingManager tM, GraphicsDevice graphics) { this.tM = tM; Constants.Credits = 8980; Constants.cYardHp = 5; this.graphics = graphics; modeState = ModeState.None; tM.DrawBackgroundLayer(); errorSnd = MediaHandler.ErrorSnd.CreateInstance(); buildSnd = MediaHandler.Build.CreateInstance(); sellSnd = MediaHandler.Sell.CreateInstance(); clickSnd = MediaHandler.Click.CreateInstance(); cancel = MediaHandler.Cancel.CreateInstance(); }
public void UpdateMode(int incMode) { StopTracking(); switch (incMode) { case 0: mCurrentModeState = ModeState.TrackingMode; mWindow.ControlPan.StartButton.IsEnabled = true; mWindow.ControlPan.StopButton.IsEnabled = true; mWindow.ControlPan.AddLine.IsEnabled = false; mWindow.ControlPan.AddParabola.IsEnabled = false; mWindow.ControlPan.AddSine.IsEnabled = false; mGraphPlot.ChangeAxes(0, 10, -5, 5); break; case 1: mCurrentModeState = ModeState.EditingMode; mWindow.ControlPan.StartButton.IsEnabled = true; mWindow.ControlPan.StopButton.IsEnabled = true; mWindow.ControlPan.AddLine.IsEnabled = true; mWindow.ControlPan.AddParabola.IsEnabled = true; mWindow.ControlPan.AddSine.IsEnabled = true; mGraphPlot.ChangeAxes(-10, 10, -10, 10); break; case 2: mCurrentModeState = ModeState.MatchingMode; mWindow.ControlPan.StartButton.IsEnabled = true; mWindow.ControlPan.StopButton.IsEnabled = true; mWindow.ControlPan.AddLine.IsEnabled = true; mWindow.ControlPan.AddParabola.IsEnabled = false; mWindow.ControlPan.AddSine.IsEnabled = false; mGraphPlot.ChangeAxes(0, 10, 0, 5); break; default: mCurrentModeState = ModeState.TrackingMode; mWindow.ControlPan.StartButton.IsEnabled = true; mWindow.ControlPan.StopButton.IsEnabled = true; mWindow.ControlPan.AddLine.IsEnabled = false; mWindow.ControlPan.AddParabola.IsEnabled = false; mWindow.ControlPan.AddSine.IsEnabled = false; mGraphPlot.ChangeAxes(0, 10, -5, 5); break; } }
// Use this for initialization void Start() { // 各種コントローラへ初期値を設定していく setPlayerController(); // プレイヤーコントローラ setCameraController(); // カメラコントローラ setItemController(); // アイテムコントローラ setUiController(); // UIコントローラ // 各種値の初期化 setup(); //現在のステートをゲーム開始前に設定 nowState = ModeState.TITLE; // UI表示をタイトルのものにする uiController.setUiTitleActive(); }
public void OnPeerJoinedGameEvt(object sender, PeerJoinedGameArgs ga) { bool isLocal = ga.peer.PeerId == appl.LocalPeer.PeerId; if (isLocal && _CurrentState == ModeState.JoiningGame) { logger.Info("Splash game joined"); // Create gameInstance and associated Apian game = new BeamAppCore(appl.frontend); game.PlayerJoinedEvt += OnPlayerJoinedEvt; game.NewBikeEvt += OnNewBikeEvt; BeamApian apian = new BeamApianSinglePeer(appl.gameNet, game); // This is the REAL one // BeamApian apian = new BeamApianCreatorServer(core.gameNet, game); // Just for quick tests of CreatorServer appl.AddAppCore(game); // Dont need to check for groups in splash apian.CreateNewGroup(ApianGroupId, ApianGroupName); BeamPlayer mb = new BeamPlayer(appl.LocalPeer.PeerId, appl.LocalPeer.Name); game.GroupJoinedEvt += OnGroupJoinedEvt; apian.JoinGroup(ApianGroupId, mb.ApianSerialized()); _CurrentState = ModeState.JoiningGroup; // waiting for OnPlayerJoined(localplayer) } }
// Update is called once per frame void Update() { if (SawModeIsActive() && state == ModeState.Deactivated) { modeObject.GetComponent <SawMode>().SetAction(); state = ModeState.Activated; } if (state == ModeState.Activated) { modeTimer += Time.deltaTime; if (modeTimer >= modeLength) { foreach (GameObject x in collumns) { x.GetComponent <CollumnController>().Deactivate(); modeObject.GetComponent <SawMode>().SetAction(); state = ModeState.Deactivated; } modeTimer = 0.0f; } } }
// Update is called once per frame void Update() { // TODO: 今回は単純だからswitchによる管理のみでいいけど、いつかきちんとステートマシンで実装したいです // 状態遷移チェック(条件が一致すれば画面遷移ステートを変更し、新しい画面に対応した初期化や初期処理を行う) switch (nowState) { case ModeState.TITLE: if (Input.GetKeyDown(KeyCode.Space)) { //スペースキーでスタート // STARTステートに変更 nowState = ModeState.START; // プレイヤーコントローラにより移動のコンポーネントを有効化し、 // プレイヤーの移動を無効化にする //playerController.EnableControl(); //playerController.isNotMoveable(); // カメラコントローラによりカメラの移動を無効化する cameraController.moveable = false; // アイテムコントローラから、アイテムの初期配置を行う itemController.setupItems(); // UI表示をスタートステート用UIに切り替える uiController.setUiStartActive(); // 取得目標アイテム数をUIに設定 uiController.updateUiStart(targetItemCount); //Debug.Log("STARTステートに変更"); } break; case ModeState.START: if ((int)startTime >= startMaxTime) { // COUNTDOWNステートに変更 nowState = ModeState.COUNTDOWN; // カウントダウンの開始値を開始時間-1して設定 countDownTime = (float)countDownMaxTime - 1; // UI表示をカウントダウンステート用UIに切り替える uiController.setUiCountdownActive(); //Debug.Log("COUNTDOWNステートに変更"); } break; case ModeState.COUNTDOWN: if (countDownTime < -0.0f) { // PLAYINGステートに変更 nowState = ModeState.PLAYING; // プレイヤーコントローラにより移動のコンポーネントを有効化し、 // プレイヤーの移動を有効化にする playerController.EnableControl(); playerController.isMoveable(); // カメラコントローラによりカメラの移動を有効化する cameraController.moveable = true; // UI表示をゲームステート用UIに切り替える uiController.setUiScoreActive(); //Debug.Log("PLAYINGステートに変更"); } break; case ModeState.PLAYING: if (gameTime >= gameMaxTime) { // RESULTステートに変更 nowState = ModeState.RESULT; // プレイヤーコントローラによりプレイヤーの移動等を無効化する playerController.DisableControl(); //playerController.isNotMoveable(); // アイテムを無効化する itemController.stopGetItems(); // カメラコントローラによりカメラの移動を無効化する cameraController.moveable = false; // UI表示を結果表示ステート用UIに切り替える uiController.setUiResultActive(); // 結果計算処理を行う(オミット) // 集計結果をUIに設定 uiController.updateUiResult(getItemCount, targetItemCount); //Debug.Log("RESULTステートに変更"); } break; case ModeState.RESULT: if (restartTime < resultTime) { // 時間系パラメータやアイテム数の初期化 setup(); //playerController.EnableControl(); playerController.isNotMoveable(); // カメラ位置およびプレイヤー位置の初期化 playerController.ResetPlayer(); cameraController.ResetCamera(); // TITLEステートに変更 nowState = ModeState.TITLE; // UI表示をタイトルのものにする uiController.setUiTitleActive(); } break; } // 画面遷移ステートごとの処理分岐 switch (nowState) { case ModeState.START: // 表示時間を加算 setStartTime(); //Debug.Log("STARTステートです"); break; case ModeState.COUNTDOWN: // 現在のカウントダウンの数値をUIに設定 // TODO: 前の数値を格納しておき、数値が変わったタイミングでUI更新を行う uiController.updateUiCountdown(countDownTimeSeconds); // カウントダウンを減算 setCountDownTime(); //Debug.Log("COUNTDOWNステートです"); break; case ModeState.PLAYING: // 現在の各種値をUIに設定 // TODO: 前の数値を格納しておき、数値が変わったタイミングでUI更新を行う if (UIMaskTime <= gameTimeSeconds) { // TODO: 実際はUI側でモザイク処理を行う uiController.updateUiScore <string>(gameTimeSeconds, "***", "***"); } else { uiController.updateUiScore <int>(gameTimeSeconds, getItemCount, targetItemCount); } // プレイ時間を加算 setGameTime(); // アイテム補てんを行う itemController.updateItems(); //Debug.Log("PLAYINGステートです"); //Debug.Log("gameTimeSeconds = " + gameTimeSeconds); break; case ModeState.RESULT: // 結果画面を加算 setResultTime(); //Debug.Log("RESULTステートです"); break; } }
void Start() { m_mainState = MainState.START; //スタートから開始 // セリフUI設定 CharacterWordsUI sayUI = GameObject.Find("SekkenSayUI").GetComponent <CharacterWordsUI>(); m_sayUI = GameObject.Find("SekkenSayUI").GetComponent <PauseObject>(); if (sayUI) { switch (SceneData.characterSelect) { case SceneData.CharacterSelect.SekkenKun: sayUI.ChangeSekken(CharacterWordsUI.ESekkenNo.SekkenKun); break; case SceneData.CharacterSelect.SekkenHero: sayUI.ChangeSekken(CharacterWordsUI.ESekkenNo.SekkenHero); break; case SceneData.CharacterSelect.SekkenChan: sayUI.ChangeSekken(CharacterWordsUI.ESekkenNo.SekkenChan); break; } } player = GameObject.Find("PlayerCharacter"); m_dirtySystemObject = GameObject.Find("DirtySystem"); dirtySystem = m_dirtySystemObject.GetComponent <DirtySystem>(); recoverySoapCreatersManager = GameObject.Find("RecoverySoapCreatersManager").GetComponent <RecoverySoapCreatersManager>(); pushKey = GameObject.Find("PushKey"); poseMenu = GameObject.Find("PauseCur").GetComponent <PoseMenu>(); m_playRecordAsPauseObject.pausing = true; m_endUI = GameObject.Find("EndUI").GetComponent <PauseObject>(); m_dirtys = GameObject.Find("StartVisualizeSystems").GetComponent <PauseObject>(); m_pauseSystems = GameObject.Find("StartStopSystems").GetComponent <PauseObject>(); m_dirtySystem = GameObject.Find("DirtySystem").GetComponent <PauseObject>(); //ActionRecordManager.sActionRecord.Reset(); //モード確認 SelectingCharactor no = GameObject.Find("CharNo").GetComponent <SelectingCharactor>(); // if (no != null) { if (SceneData.modeSelect == PlayModeState.NORMAL) { m_modeState = ModeState.NORMAL_PLAY; m_pauseSystems.pausing = true; m_instructPuase.pausing = true; } else { m_modeState = ModeState.FREE_PLAY; m_sizeCounterUI.pausing = true; m_dirtyCounterUI.pausing = true; m_washChainUI.pausing = true; m_pauseSystems.pausing = true; //m_dirtys.gameObject.SetActive(false); } } no.loaded = true; m_pauseSystems.pausing = true; ExecuteStateEnterProcesss(m_mainState); BGMManager.Instance.PlayBGM("GameMain_BGM", 0); }
void Start() { state = ModeState.Deactivated; }