protected override void HandleInput(GameTime gameTime) { // handle each player's input foreach (var player in players) { player.HandleInput(GameState, gameTime); // check if the player has any messages to pass on switch (player.Message) { case Player.InputMessage.SkipToNextScreen: if (state == MainState.start) { background = howTexture; state = MainState.how; timeElapsed = TimeSpan.Zero; } else if (state == MainState.how) { CurrentState = ScreenState.Finished; } break; } } }
public void UpdateWithFinilizer() { Settings settings = new Settings(); settings.Level = GetTypeInfo(typeof(TestLevelUpdateDraw)); sim.Start(settings); Assert.AreEqual(SimulationState.Running, sim.State); MainState state = null; // Erste Runde state = sim.NextState(); Assert.AreEqual(0, state.Round); Assert.AreEqual(LevelMode.Running, state.Mode); Assert.AreEqual(SimulationState.Running, sim.State); // Zweite Runde state = sim.NextState(); Assert.AreEqual(1, state.Round); Assert.AreEqual(LevelMode.Running, state.Mode); Assert.AreEqual(SimulationState.Running, sim.State); // Dritte Runde state = sim.NextState(); Assert.AreEqual(2, state.Round); Assert.AreEqual(LevelMode.Draw, state.Mode); Assert.AreEqual(SimulationState.Finished, sim.State); Assert.IsNull(sim.LastException); }
// Update is called once per frame void FixedUpdate() { /* <summary> * Right now there are not actual values coming from the exporter, so I will define fixed values: * * -multiple ray casts in cone shape coming from sensor * -return length of shortest raycast * * 3. This distance will be the output of the sensor, and should read out to the screen? * * 4. Feedback to emulation. * */ //var as the type (lambda function) //these variables can only live INSIDE a function. if (main == null) { main = GameObject.Find("StateMachine").GetComponent <StateMachine>().CurrentState as MainState; } else { isMetric = main.IsMetric; } UpdateOutputDisplay(); Debug.Log(ReturnOutput()); }
/// <summary> /// Called when a game is successfully completed. /// </summary> void MiniGameSuccessful() { mainState_ = MainState.MINIGAMESUCCESSED; //State is set to successed. This will cause the mini game index to be increased in SetPlayerExitCubeTimeout lightController_.MainLight_.SuccessfuleLight(); //Turn lights green //InputController.Instance.OnGridUp_ += OnWandGridButtonDown; if (usingCard_ == UsingCard.GAMBLE) { //currentGambleCard_--; SetUsingCard(UsingCard.GAMBLE); SetLives(1); } else if (usingCard_ == UsingCard.HELP) { //currentHelpCard_--; SetUsingCard(UsingCard.HELP); } else if (usingCard_ == UsingCard.PRACTICE) { //currentPracticeCard_--; currentMiniGameIndex_--; SetUsingCard(UsingCard.PRACTICE); } else if (usingCard_ == UsingCard.DOUBLEPOINTS) { OnPointsChange(GameData_.EachGamePointsWin_); } SetPlayerExitCube(); }
IEnumerator AnimGameOver() { MainCanvas.Main.inGameScript.MoveScoreDown(); yield return(new WaitForSeconds(0.5f)); int score = MainCanvas.Main.inGameScript.scoreInt; if (score > Settings.GetBest) { Settings.SetBest(score); } SetBestScore(Settings.GetBest); MainObjControl.Instant.camCrt.allow = false; StartCoroutine(EffectControl.FadeInCanvas(bestText.gameObject, 0.5f)); yield return(new WaitForSeconds(0.2f)); StartCoroutine(EffectControl.FadeInCanvas(tap, 0.5f)); StartCoroutine(EffectControl.ScaleInCanvas(buttonPanel, 0.4f)); yield return(new WaitForSeconds(0.4f)); MainState.SetState(MainState.State.GameOver); // MainAudio.Main.PlaySound(TypeAudio.SoundLose); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } //Main FSM switch (state) { case MainState.Menu: state = menu.Update(); if (state == MainState.Play) { play.SetUp(); } break; case MainState.Instructions: state = instructions.Update(); break; case MainState.HatSelect: //Currently unused //May be cut in the future break; case MainState.Play: state = play.Update(gameTime); break; } base.Update(gameTime); }
public void ChangeTask(QuestTask curTask, MainState state) { if (state == MainState.Started && curTask.mainState == MainState.NotStarted) { curTask.ChangeMainState(state); if (!point.pointContainer.Contains(this)) { point.pointContainer.Add(this); } } else if ((state == MainState.Completed || state == MainState.Failed) && (curTask.mainState != MainState.Completed && curTask.mainState != MainState.Failed)) { curTask.ChangeMainState(state); bool flag = false; foreach (QuestTask task in tasks) { if (task.mainState == MainState.Started) { flag = true; break; } } if (!flag) { point.pointContainer.Remove(this); } } }
private void NewGame(GameMode gameMode) { this.gameMode = gameMode; GameInfo.Instance.NewGame(); lastMove = null; lastMoveHint.UnFocus(); moveState = MoveState.Idle; ClearEffect(); hint.ClearHints(); if (gameMode == GameMode.Agent) { InitAgent(); } board.NewGame(); storage.NewGame(); switchModeUI.NewGame(); state = MainState.Ready; turn = Unit.OwnerEnum.Black; turnNum = 0; if (resultUI != null) { resultUI.gameObject.SetActive(false); } storage.IsEndTurnValid = false; storage.IsCancelValid = false; _actionLogs.Clear(); _actionsCurrentTurn.Clear(); statusUI.ShowAction(); }
public override void Start() { mainState = StateMachine.SceneGlobal.FindState <MainState>(); canvas = GameObject.Find("Canvas"); dpmToolbar = Auxiliary.FindObject(canvas, "DPMToolbar"); gamepieceDropdownButton = Auxiliary.FindObject(dpmToolbar, "GamepieceDropdownButton"); gamepieceDropdownArrow = Auxiliary.FindObject(gamepieceDropdownButton, "Arrow"); gamepieceDropdownLabel = Auxiliary.FindObject(gamepieceDropdownButton, "GamepieceName"); gamepieceDropdownExtension = Auxiliary.FindObject(gamepieceDropdownButton, "Scroll View"); gamepieceDropdownExtension.SetActive(false); gamepieceDropdownPrefab = Resources.Load("Prefabs/GamepieceDropdownElement") as GameObject; dropdownLocation = Auxiliary.FindObject(gamepieceDropdownButton, "DropdownLocation").transform; tabs = Auxiliary.FindObject(canvas, "Tabs"); helpMenu = Auxiliary.FindObject(canvas, "Help"); overlay = Auxiliary.FindObject(canvas, "Overlay"); helpBodyText = Auxiliary.FindObject(canvas, "BodyText").GetComponent <Text>(); trajectoryPanel = Auxiliary.FindObject(canvas, "TrajectoryPanel"); gamepieceIndex = FieldDataHandler.gamepieceIndex; Button helpButton = Auxiliary.FindObject(helpMenu, "CloseHelpButton").GetComponent <Button>(); helpButton.onClick.RemoveAllListeners(); helpButton.onClick.AddListener(CloseHelpMenu); InitGamepieceDropdown(); }
/// /// <summary> ステートを抜ける時の処理. </summary> /// /// <remarks> Kazuyuki,. </remarks> /// /// <param name="exitState"> State of the exit. </param> /// void ExecuteStateExitProcesss(MainState exitState) { switch (exitState) { case MainState.START: break; case MainState.PLAY: dirtySystem.IsRunning = false; recoverySoapCreatersManager.IsRunning = false; break; case MainState.PAUSE: break; case MainState.PLAY_RECORD: m_pauseScreenUI.PushPose(); m_playRecordAsPauseObject.PushPose(); break; case MainState.CHECK_TRANSITION: m_checkTransitionMenuScreeenUI.PushPose(); m_pauseScreenUI.PushPose(); break; case MainState.END: break; default: break; } }
// Update is called once per frame void Update() { if (main == null) { main = StateMachine.SceneGlobal.FindState <MainState>(); } }
// Update is called once per frame void Update() { if (mainState == null) { mainState = ((MainState)StateMachine.Instance.CurrentState); } if (usingRuler) { if (ignoreClick) { ignoreClick = false; } else { ClickRuler(); } } UpdateStopwatch(); if (statsOn) { UpdateStatsWindow(); } //UpdateControlIndicator(); }
protected override void Initialize() { base.Initialize(); collisionManager = new CollisionManager(); projectileSpriteFactory = new ProjectileSpriteFactory(this); projectileHandler = new ProjectileHandler(this); link = new Classes.Link(this); linkStateMachine = new LinkStateMachine(link); link.SetState(linkStateMachine); hudSpriteFactory = new HudSpriteFactory(this); enemySpriteFactory = new EnemySpriteFactory(this); controllerList.Add(new CKeyboard(this)); controllerList.Add(new CMouse(this)); controllerList.Add(new ItemSelectionController(this)); neighbors = Parser.ParseNeighborCSV(); roomList = new List <Room>(); util.roomNumber = util.startingRoomNumber(); for (int i = 1; i < util.numberOfRooms() + 1; i++) { roomList.Add(Parser.ParseRoomCSV(this, i)); } foreach (Room r in roomList) { if (r.getRoomNumber() == util.roomNumber) { currentRoom = r; } } currentRoom.Initialize(); currentMainGameState = new MainState(this, currentRoom); currentGameState = currentMainGameState; MediaPlayer.Play(song); MediaPlayer.IsRepeating = true; }
// Update is called once per frame void Update() { //副程式:設定置產按鈕是否可用 if (!DecisionBool) { Set_ManageButton_Button(); } //設定Text***************************************************** //持有金錢 MainState.SetText_OwnMoney(OwnMoney_Text); //佔有率 Set_Present_Text(); //預期利潤 Set_Price_Text(); //副程式:設定店鋪數Text Set_StoreNumber_Text(); //副程式:設定店鋪名稱Text Set_StoreName_Text(); //副程式:設定置產店鋪名稱Text Set_BuyStoreName_Text(); //設定圖片******************************************************** //副程式:設定佔有率圖片 Set_Present_Image(); //副程式:設定區域圖片 Set_Area_Image(); //副程式:設定店鋪分類圖片 Set_Store_Class_Image(); //副程式:設定店鋪圖片 Set_Store_Image(); //副程式:設定店鋪是否擁有圖片 Set_Store_Own_Image(); //副程式:設定現在選擇店鋪圖片 Set_SelectStore_Image(); }
//副程式(按鈕):開啟決定畫面 public void Set_Decision() { //播放PayBack音效 MainState.PayBack_Button_Sounds_Play(); //顯示決定畫面 Decision.SetActive(true); //麵包師傅按鈕設為不能用 Bread_Button.interactable = false; //音樂人按鈕設為不能用 Music_Button.interactable = false; //科技新貴按鈕設為不能用 Technology_Button.interactable = false; //機工按鈕設為不能用 Factory_Button.interactable = false; //銀行家按鈕設為不能用 Bank_Button.interactable = false; //離開按鈕設為不能用 ExitButton.interactable = false; //置產按鈕設為不能用 ManageButton.interactable = false; //變更狀態為決定畫面 DecisionBool = true; //向上按鈕設為不能用 PreviousButton.interactable = false; //向下按鈕設為不能用 NextButton.interactable = false; }
void Update() { if (mainState == null) { mainState = StateMachine.SceneGlobal.FindState <MainState>(); } else { if (dpmRobot == null) { dpmRobot = mainState.ActiveRobot.GetDriverPractice(); FindElements(); } if (mainState.ActiveRobot.GetDriverPractice() != dpmRobot) { OnActiveRobotChange(); } SetGamepieceIndex(); if (trajectory && !editing) { UpdateTrajectoryValues(); } if (dpmRobot.drawing && DPMDataHandler.dpmodes.Where(d => d.gamepiece.Equals(FieldDataHandler.gamepieces[gamepieceIndex].name)).ToArray().Length > 0) { DrawTrajectory(); } else { trajectoryLine.GetComponent <LineRenderer>().enabled = false; } } }
// Update is called once per frame void Update() { if (mainState == null) { mainState = StateMachine.Instance.FindState <MainState>(); } if (usingRuler) { if (ignoreClick) { ignoreClick = false; } else { ClickRuler(); } } UpdateStopwatch(); if (statsOn) { UpdateStatsWindow(); } //UpdateControlIndicator(); if (Input.GetKeyDown(KeyCode.P) && stopwatchWindow.activeSelf) { PauseStopwatch(); } }
/// <summary> /// ゲームを止めるときまたはゲームを再開するときに呼ぶ関数 /// </summary> public void ChangeGameState() { if (state == MainState.playStop && state != MainState.playResult) { state = MainState.playNow; // メニュー画面のUI非表示 // プレイヤーの動かせる PlayerController.Instance.ReStartPlayerPlayerController(); // エネミーの動かせる return; } if (state == MainState.playNow && state != MainState.playResult) { state = MainState.playStop; // プレイヤーの動きを止める PlayerController.Instance.StopPlayerPlayerController(); // エネミーの動きを止める // メニュー画面のUI表示 return; } }
public void Request(MainState state) { if (PhotonNetwork.InRoom) { photonView.RpcSecure("ChangeState", RpcTarget.All, true, (int)state); } }
//副程式(按鈕):決定畫面取消 public void Set_Decision_Cancel() { //播放取消按鈕音效 MainState.Cancel_Button_Sounds_Play(); //隱藏決定畫面 Decision.SetActive(false); //經理頁面按鈕設為能用 ManageButton.interactable = true; //警衛頁面按鈕設為能用 SecurityButton.interactable = true; //顧問頁面按鈕設為能用 ConsultantButton.interactable = true; //離開按鈕設為能用 ExitButton.interactable = true; //僱用按鈕設為能用 HireButton.interactable = true; //變更狀態為不是決定畫面 DecisionBool = false; //向上按鈕設為能用 PreviousButton.interactable = true; //向下按鈕設為能用 NextButton.interactable = true; //設定頁面按鈕 Set_Now_Number(Now_Number); }
private void Update() { if (main == null) { main = StateMachine.Instance.FindState <MainState>(); } //Find the dynamic camera if (dynamicCamera == null) { dynamicCamera = GameObject.Find("Main Camera").GetComponent <DynamicCamera>(); } //When the current sensor is ready to be configured, call its UpdateTransformFunction and update its angle, range & node text in the corresponding panels if (currentSensor != null && currentSensor.IsChangingPosition) { currentSensor.UpdateTransform(); UpdateSensorAnglePanel(); UpdateSensorRangePanel(); } showSensorButton.SetActive(sensorManager.GetActiveSensors().Count > 0 && isHidingOutput); //Allows users to save their configuration using enter if (isEditingAngle && Input.GetKeyDown(KeyCode.Return)) { ToggleEditAngle(); } if (isEditingRange && Input.GetKeyDown(KeyCode.Return)) { ToggleEditRange(); } }
/// <summary> /// Since main state is not initialized immediately (after a frame or two), we look for it in the update function which is called every step /// </summary> void Update() { if (mainState == null) { mainState = ((MainState)StateMachine.Instance.CurrentState); } }
private void Update() { //Make sure main state and dynamic camera get initialized if (main == null) { main = StateMachine.Instance.FindState <MainState>(); dynamicCamera = main.DynamicCameraObject.GetComponent <DynamicCamera>(); } //Update gui about robot camera once main and dynamic camera is ready else if (main != null && dynamicCamera != null) { UpdateCameraWindow(); if (indicatorActive) { UpdateCameraAnglePanel(); UpdateCameraFOVPanel(); UpdateNodeAttachment(); UpdateIndicatorTransform(); } } //Allows users to save their configuration using enter if (isEditingAngle && Input.GetKeyDown(KeyCode.Return)) { ToggleEditAngle(); } if (isEditingFOV && Input.GetKeyDown(KeyCode.Return)) { ToggleEditFOV(); } }
void Start() { string saveDataFile = gameTempSavePath; if (System.IO.File.Exists(saveDataFile)) { // load game save and goto game main ui directly GameObject gameMainUI = ScreenManager.instance().get("GameMainUI"); MainState mainState = gameMainUI.GetComponent <MainState>(); try { GameSaveData saveData = (GameSaveData)PlatformUtils.readObject(saveDataFile, typeof(GameSaveData)); ScreenManager.show(gameMainUI, true); mainState.restart(); mainState.loadGame(saveData); clearSave(); return; } catch (System.Exception e) { if (Application.isEditor) { throw e; } Debug.Log(e.ToString()); ScreenManager.show(gameMainUI, false); } finally { System.IO.File.Delete(saveDataFile); } } ScreenManager.instance().show("StartMenu", true); }
public async Task <bool> HostSurvey() { Console.WriteLine($"DEBUG: Creating new host instance with selected survey"); state = MainState.Hosting; host = new SurveyHost(); return(await host.RunSurvey()); }
// call when a mini game is failed /// <summary> /// Called when the player fails a mini game. Player loses a life and they exit the cube. /// </summary> void MiniGameFailed() { mainState_ = MainState.MINIGAMEFAILED; lightController_.MainLight_.FailedLight(); //InputController.Instance.OnGridUp_ += OnWandGridButtonDown; int lose_life = -1; if (usingCard_ == UsingCard.GAMBLE) //If the player is using the gamble card, they lose extra lives //currentGambleCard_--; { SetUsingCard(UsingCard.GAMBLE); lose_life = -2; } else if (usingCard_ == UsingCard.PRACTICE) { //currentPracticeCard_--; SetUsingCard(UsingCard.PRACTICE); lose_life = 0; } else if (usingCard_ == UsingCard.HELP) { //currentHelpCard_--; SetUsingCard(UsingCard.HELP); } else if (usingCard_ == UsingCard.DOUBLEPOINTS) { OnPointsChange(GameData_.EachGamePointsLose_); } SetLives(lose_life); SetPlayerExitCube(); }
/// <summary> /// Since main state is not initialized immediately (after a frame or two), we look for it in the update function which is called every step /// </summary> void Update() { if (mainState == null) { mainState = StateMachine.Instance.FindState <MainState>(); } }
public static void AddState(MainState state) { if (States == null) States = new List<MainState>(); if (!States.Contains(state)) States.Add(state); }
private void Awake() { Application.targetFrameRate = 60; // 프레임 고정 Time.timeScale = 1; //실시간 main = this; MainState.SetState(MainState.State.Wait); }
private void Update() { if (main == null) { main = GameObject.Find("StateMachine").GetComponent <StateMachine>().CurrentState as MainState; } else if (dynamicCamera == null && main.dynamicCameraObject != null) { dynamicCamera = main.dynamicCameraObject.GetComponent <DynamicCamera>(); } else if (main != null && dynamicCamera != null) { UpdateCameraWindow(); UpdateCameraAnglePanel(); UpdateCameraFOVPanel(); UpdateNodeAttachment(); } if (CameraIndicator.activeSelf) { CameraIndicator.transform.position = robotCamera.CurrentCamera.transform.position; CameraIndicator.transform.rotation = robotCamera.CurrentCamera.transform.rotation; CameraIndicator.transform.parent = robotCamera.CurrentCamera.transform; } }
public override void Start() { canvas = GameObject.Find("Canvas"); camera = GameObject.Find("Main Camera").GetComponent <DynamicCamera>(); tabs = Auxiliary.FindObject(canvas, "Tabs"); toolbar = Auxiliary.FindObject(canvas, "MainToolbar"); changeRobotPanel = Auxiliary.FindObject(canvas, "ChangeRobotPanel"); robotListPanel = Auxiliary.FindObject(changeRobotPanel, "RobotListPanel"); changePanel = Auxiliary.FindObject(canvas, "ChangePanel"); addPanel = Auxiliary.FindObject(canvas, "AddPanel"); changeFieldPanel = Auxiliary.FindObject(canvas, "ChangeFieldPanel"); pointImpulsePanel = Auxiliary.FindObject(canvas, "PointImpulsePanel"); resetDropdown = GameObject.Find("ResetRobotDropdown"); multiplayerPanel = Auxiliary.FindObject(canvas, "MultiplayerPanel"); stopwatchWindow = Auxiliary.FindObject(canvas, "StopwatchPanel"); statsWindow = Auxiliary.FindObject(canvas, "StatsPanel"); rulerWindow = Auxiliary.FindObject(canvas, "RulerPanel"); // To access instatiate classes within a state, use the StateMachine.SceneGlobal toolkit = StateMachine.SceneGlobal.GetComponent <Toolkit>(); multiplayer = StateMachine.SceneGlobal.GetComponent <LocalMultiplayer>(); simUI = StateMachine.SceneGlobal.GetComponent <SimUI>(); menuUI = StateMachine.SceneGlobal.GetComponent <MenuUI>(); robotCameraGUI = StateMachine.SceneGlobal.GetComponent <RobotCameraGUI>(); sensorManagerGUI = StateMachine.SceneGlobal.GetComponent <SensorManagerGUI>(); State = StateMachine.SceneGlobal.CurrentState as MainState; cameraViewDropdown = Auxiliary.FindObject(canvas, "CameraDropdown").GetComponent <Dropdown>(); dynamicCamera = UnityEngine.Camera.main.transform.GetComponent <DynamicCamera>(); }
void Update() { if(this.state != this.oldState) { if(this.state == MainState.PostDissolution) { this.firstTube.state = TubeBehaviour.TubeState.Idle; this.secondTube.state = TubeBehaviour.TubeState.Idle; this.firstTube.sample.state = SampleBehaviour.SampleState.Dissolved; this.secondTube.sample.state = SampleBehaviour.SampleState.Dissolved; } this.oldState = this.state; } if(this.state == MainState.StartAnimation) { //this.animation.Play("CameraFlyIn", AnimationPlayMode.Stop); this.state = MainState.Filling; } else if(this.state == MainState.Dissolution) { this.GetComponent<Animation>().Play("TubeCloseUp", AnimationPlayMode.Stop); } if(this.firstTube.isDissolving() && this.secondTube.isDissolving() && this.state != MainState.PostDissolution) { this.state = MainState.Dissolution; this.pincet.state = PincetBehaviour.PincetState.Idle; } if(this.oldState == MainState.PostDissolution && feSample.isReturned() && znSample.isReturned()) { this.state = MainState.Finishing; } if(oldState == MainState.Finishing && this.pincet.isReturned()) { this.state = MainState.Finished; } if(this.oldState == MainState.Filling && firstTube.isFilled() && secondTube.isFilled()) { this.state = MainState.Filled; } if(this.oldState == MainState.Filled && this.container.isReturned()) { this.state = MainState.Pincet; } }
void Awake() { mainState = MainState.None; GoPlaySdk.Instance.UseLiveServer = false; GoPlaySdk.Instance.OnLogin+= HandleOnLogin; GoPlaySdk.Instance.OnRegister+= HandleOnRegister; GoPlaySdk.Instance.OnLogOut+= HandleOnLogOut; GoPlaySdk.Instance.OnGetUnFullFilledExchanges += HandleOnGetUnFullFilledExchanges; GoPlaySdk.Instance.OnFullFillExchange += HandleOnFullFillExchange; GoPlaySdk.Instance.OnUpdateExternalExchange += HandleOnUpdateExternalExchange; GoPlaySdk.Instance.OnRejectExchange += HandleOnRejectExchange; GoPlaySdk.Instance.OnGetProgress += HandleOnGetProgress; GoPlaySdk.Instance.OnSaveProgress += HandleOnSaveProgress; GoPlaySdk.Instance.OnReadProgress += HandleOnReadProgress; }
public static void StartEngine(ILazyEngine engine) { _engine = engine; Clear(); foreach (MainState mainState in _engine.States) { AddState(mainState); } lock (States) { States.Add(new StateIdle()); LastState = States[States.Count() - 1]; //Set the last state to StateIdle } States.Sort(); Logging.Write("[Engine]Initializing"); Paused = false; Running = true; // Leave it as a background thread. _workerThread = new Thread(Run) {IsBackground = true}; _workerThread.Name = "Engine"; _workerThread.SetApartmentState(ApartmentState.STA); _workerThread.Start(); Logging.Write("[Engine]Started bot thread"); }
//=================================================================================================================o void DoSneak(bool b) { if (b) { // Only remember Normal or Combat state if (mainState == MainState.Combat || mainState == MainState.Normal) { lastMainState = (int)mainState; } mainState = MainState.Sneak; } else { if (lastMainState == (int)MainState.Combat || lastMainState == (int)MainState.Normal) { mainState = (MainState)lastMainState; } } }
//=================================================================================================================o void DoPhysx(string s) { switch (s) { case "Start": EvadeReset(); mainState = MainState.Physic; break; case "End": bool inCombat = sword_Hand.active || bow_Hand.active || rifle_Hand.active || pistol_Hand.active; mainState = inCombat ? MainState.Combat : MainState.Normal; break; case "Front": standUpM = s; break; case "Back": standUpM = s; break; case "Roll_Impact": impactM = a["roll_impact"].clip; break; case "Land": impactM = a["land"].clip; break; } }
public static void StopEngine() { if (!Running) { return; } Running = false; if (_workerThread.IsAlive) { _workerThread.Abort(); } // Clear out the thread object and let the garbage collector get it _workerThread = null; States = null; LastState = null; _engine = null; GC.Collect(); }
//=================================================================================================================o void DoSwan() { canLand = false; mainState = MainState.Evade; Invoke ("Evade", a["cliff_jump"].length); //a["cliff_jump"].wrapMode = WrapMode.ClampForever; //a.CrossFade ("cliff_jump", 0.4f); }
private void BeginAILogic() { if(ai.MyTurn == turn) { state = MainState.AI_Thinking; ai.Think(board); logger.Text = "思考中"; logger.State = UILogger.StateEnum.Dot; } }
public MainMenuScreen(Islander.GameState gameState) { GameState = gameState; state = MainState.start; }
//=================================================================================================================o void Fall() { if (hMotor.Grounded || climbState != ClimbState.None || hSwim.isSwimming || mainState == MainState.Physic || mainState == MainState.Evade) { return; } mainState = MainState.Falling; }
//=================================================================================================================o void DoBalance(bool b) { if (b) { mainState = MainState.Balance; } else { bool inCombat = sword_Hand.active || bow_Hand.active || rifle_Hand.active || pistol_Hand.active; mainState = inCombat ? MainState.Combat : MainState.Normal; } }
private void MouseEvent(Vector3 point) { if (moveState == MoveState.Idle) { if (Input.GetMouseButtonUp(0)) { Position pos = Unit.ScreenToPos(new Vector2(point.x, point.y)); if (pos.IsValid) { if (board.GetUnitOwner(pos) == Turn) { moveState = MoveState.Pick; hint.SetMoveHint(board.GetUnit(pos)); } } } } else if (moveState == MoveState.Pick) { if (Input.GetMouseButtonUp(0)) { Position pos = Unit.ScreenToPos(new Vector2(point.x, point.y)); if (pos.IsValid) { if(CheckMoveOffset(pos - hint.Source.Pos)) { if (Move(hint.Source, board.GetUnit(pos), pos)) { state = MainState.Wait; } } hint.ClearHints(); moveState = MoveState.Idle; } } else if (Input.GetMouseButtonUp(1)) { hint.ClearHints(); moveState = MoveState.Idle; } } }
private void NewGame(GameMode gameMode) { this.gameMode = gameMode; lastMove = null; moveState = MoveState.Idle; ClearEffect(); hint.ClearHints(); board.NewGame(); storage.NewGame(); state = MainState.Ready; turn = Unit.OwnerEnum.Black; resultSprite.gameObject.SetActive(false); turnOverButton.gameObject.SetActive(false); if (gameMode != GameMode.Normal) InitAI(); logger.Text = ""; logger.State = UILogger.StateEnum.Normal; }
private void StartGame() { state = MainState.Move; }
void Update() { if (state == MainState.Over || IsEffecting) return; if (state == MainState.AI_Thinking) { if (ai.State == AIPlayer.StateEnum.Complete) { logger.Text = string.Format("花费时间 : {0}ms", ai.CostTime); logger.State = UILogger.StateEnum.Normal; state = MainState.AI_Running; } } if (state == MainState.AI_Running) { if (DoAIAction()) { NextTurn(); } } else { RaycastHit hit; if (board.collider.Raycast(GlobalInfo.Instance.mainCamera.ScreenPointToRay(Input.mousePosition), out hit, 1000f)) { Vector3 point = hit.point; if (state == MainState.Move) MouseEvent(point); } } }
public void setInitialFinished() { this.state = MainState.Filling; pincet.state = PincetBehaviour.PincetState.Idle; }
private static void Run() { try { while (Running) { try { if (Paused) { _engine.Pause(); while (Paused) { Thread.Sleep(100); } _engine.Resume(); } while (ChatQueu.QueueCount != 0) { _engine.Pause(); KeyHelper.ChatboxSendText(ChatQueu.GetItem); Thread.Sleep(100); _engine.Resume(); } foreach (MainState state in States.Where(state => state.NeedToRun)) { if (LastState != state) { if (StateChange != null) { StateChange(new object(), new NotifyStateChanged(state.Name())); Logging.Debug("State changed: " + state.Name()); } } state.DoWork(); LastState = state; break; } } catch (ThreadAbortException) { } catch (ThreadStateException h) { Logging.Write("Thread in odd state, restarting: " + h); } catch (Exception e) { if (ObjectManager.InGame) { Logging.Write("[Engine] Exception " + e); } Thread.Sleep(4000); } Thread.Sleep(1); Application.DoEvents(); } } catch (ThreadAbortException) { } catch (Exception e) { Logging.Write("[Engine]Botting error: " + e); } finally { Running = false; } }
//=================================================================================================================o void DoSwim() { if (hMotor.Grounded) { return; } mainState = MainState.Swimming; }
//=================================================================================================================o void EvadeReset() { if (doSwitchDel != null) { doSwitchDel (false); } // Double tab is false in HeroMotor // Switch to Normal or Combat if last states are.. if ((MainState)lastMainState == MainState.Balance || (MainState)lastMainState == MainState.Falling || (MainState)lastMainState == MainState.Jumping) { bool inCombat = sword_Hand.active || bow_Hand.active || rifle_Hand.active || pistol_Hand.active; mainState = inCombat ? MainState.Combat : MainState.Normal; } else mainState = (MainState)lastMainState; // Last state before evading // Reset procedural motion rotations currRot = Mathf.Lerp(currRot, 0f, Time.deltaTime); leanRot = 0f; evadeState = EvadeState.None; // Out }
//=================================================================================================================o void DoClimb(string s) { if (s == "None") { climbState = ClimbState.None; isShort = false; } // Shortclimb reset else if (s == "WallClimb") { climbState = ClimbState.WallClimb; } else if (s == "WallJump") { climbState = ClimbState.WallJump; } else if (s == "PreOh") { climbState = ClimbState.PreOh; } else if (s == "Overhang") { climbState = ClimbState.Overhang; isShort = false; } else if (s == "Prepare") { climbState = ClimbState.Prepare; } else if (s == "PreShort") { climbState = ClimbState.PreShort; } else if (s == "Ledge") { climbState = ClimbState.Ledge; } else if (s == "Catch") { climbState = ClimbState.Catch; } else if (s == "Corner") { climbState = ClimbState.Corner; } else if (s == "HangL") { climbState = ClimbState.HangL; } else if (s == "HangR") { climbState = ClimbState.HangR; } else if (s == "Climb") { climbState = ClimbState.Climb; isShort = false; } else if (s == "Short") { climbState = ClimbState.Short; isShort = true; } else if (s == "Edge") { climbState = ClimbState.Edge; climbMotion = false; } // XFadeRandom() is ready now else if (s == "Top") { climbState = ClimbState.Top; } mainState = MainState.Climbing; }
//=================================================================================================================o void FixedUpdate() { if (useMotions) { if (hMotor.Grounded) { inSprintJump = false; bool inCombat = sword_Hand.active || bow_Hand.active || rifle_Hand.active || pistol_Hand.active; AtKStateSpeedSender (); // Falling or/and Jumping & Gounded if (mainState == MainState.Falling || (mainState == MainState.Jumping && canLand)) { DoLand (); } // Jumping, Grounded else if (mainState == MainState.Jumping) { canLand = true; } // Landing smoothness, Grounded else if (mainState == MainState.Landing && !impactRoll) { // Start moving if (XZVelo.magnitude > walkSpeed *10) { mainState = inCombat ? MainState.Combat : MainState.Normal; } // Back to "normal" if land motion is almost over else if (a[impactM.name].time >= (a[impactM.name].length - 1.5f)) { mainState = inCombat ? MainState.Combat : MainState.Normal; } } // Climb handling, Grounded else if (mainState == MainState.Climbing) { if (climbState == ClimbState.None) { //mainState = MainState.Normal; mainState = inCombat ? MainState.Combat : MainState.Normal; } } // Swim handling, Grounded else if (mainState == MainState.Swimming) { //mainState = MainState.Normal; mainState = inCombat ? MainState.Combat : MainState.Normal; } } // Not Grounded else if (mainState == MainState.Jumping) { canLand = true; } else { Fall (); } } }
//=================================================================================================================o void DoCombat() { if (!hMotor.Grounded || climbState != ClimbState.None || weaponState == WeaponState.None || isWeaponDraw) { return; } // Enable / Disable swords in hand and holster // Sword if (weaponState == WeaponState.Sword) { if (mainState != MainState.Combat) // Draw { actionState = ActionState.DrawSword; StartCoroutine( DrawHolster(sword_Hand, sword_Holster, 0.4f)); mainState = MainState.Combat; } else // Holster { actionState = ActionState.DrawSword; StartCoroutine( DrawHolster(sword_Holster, sword_Hand, 0.4f)); mainState = MainState.Normal; } } // Bow else if (weaponState == WeaponState.Bow) { if (mainState != MainState.Combat) // Draw { actionState = ActionState.DrawBow; StartCoroutine( DrawHolster(bow_Hand, bow_Holster, 0.3f)); mainState = MainState.Combat; } else // Holster { actionState = ActionState.DrawBow; StartCoroutine( DrawHolster(bow_Holster, bow_Hand, 0.5f)); mainState = MainState.Normal; } } // Rifle else if (weaponState == WeaponState.Rifle) { if (mainState != MainState.Combat) // Draw { actionState = ActionState.DrawRifle; StartCoroutine( DrawHolster(rifle_Hand, rifle_Holster, 0.3f)); mainState = MainState.Combat; } else // Holster { actionState = ActionState.DrawRifle; StartCoroutine( DrawHolster(rifle_Holster, rifle_Hand, 1.2f)); mainState = MainState.Normal; } } // Pistol else if (weaponState == WeaponState.Pistol) { if (mainState != MainState.Combat) // Draw { actionState = ActionState.DrawPistol; StartCoroutine( DrawHolster(pistol_Hand, pistol_Holster, 0.5f)); mainState = MainState.Combat; } else // Holster { actionState = ActionState.DrawPistol; StartCoroutine( DrawHolster(pistol_Holster, pistol_Hand, 0.6f)); mainState = MainState.Normal; } } }
private void CheckGameOver() { Ruler.GameResult result = Ruler.CheckGame(board); if (result != Ruler.GameResult.NotYet) { state = MainState.Over; this.result = result; } }
//=================================================================================================================o void DoEvade(string s) { if (s == "W") evadeState = EvadeState.Forward; else if (s == "S") evadeState = EvadeState.Backward; else if (s == "A") evadeState = EvadeState.Left; else if (s == "D") evadeState = EvadeState.Right; if (evadeState != EvadeState.None) { lastMainState = (int)mainState; mainState = MainState.Evade; } }
public void NextTurn() { if (state == MainState.Wait || state == MainState.AI_Running) { Ruler.GameResult result = Ruler.CheckGame(board); if (result == Ruler.GameResult.NotYet) { turn = Unit.Opposite(turn); state = MainState.Move; NewTurn(); } else { state = MainState.Over; this.result = result; OnGameOver(); } } }
//=================================================================================================================o void DoJump() { canLand = false; mainState = MainState.Jumping; Invoke ("Fall", a["jump"].length); }
public void setCloseUpFinished() { this.state = MainState.PostDissolution; this.pincet.state = PincetBehaviour.PincetState.Used; }
//=================================================================================================================o void DoLand() { canLand = false; mainState = MainState.Landing; }