/*-------------------------------------------- * OnMyStateExit[ S ] - state-specific actions when we leave a state */ private void OnMyStateExit(GameStateType state) { string exitMessage = "EXIT state: " + state.ToString(); PostMessage(exitMessage); switch (state) { case GameStateType.GamePlaying: OnMyStateExitGamePlaying(); break; case GameStateType.GameWon: // do nothing break; case GameStateType.GameLost: // do nothing break; case GameStateType.Other: // cope with game starting in state 'Other' // do nothing break; } }
private void SwitchState() { if (this.kGameStateType != kNextGameStateType) { kGameState.CleanUp(); GameStateBase nextGameState = null; switch (kNextGameStateType) { case GameStateType.MainMenu: { nextGameState = new MainMenuGameState(); break; } case GameStateType.Simulation: { nextGameState = new SimulationGameState(); break; } case GameStateType.Quit: { nextGameState = new QuitGameState(); break; } } this.kGameStateType = kNextGameStateType; this.kGameState = nextGameState; nextGameState.Startup(); } }
public void OnBtnStart() { GameState = GameStateType.Gameplay; ScrTitle.SetActive (false); ScrGameplay.SetActive (true); }
public PlayableGameState(MessageHandlerID messageHandlerId, IClientPlayerInfoManager clientPlayerInfoManager, INetworkingService networkingService, CollisionManager collisionManager, PhysicsManager physicsManager, PlayerShipManager playerShipManager, ProjectileManager projectileManager, SelectionManager selectionManager, ClientShipManager clientShipManager, SimulationManager simulationManager, StructureFactoryManager structureFactoryManager, WarpHoleManager warpholeManager, TeamManager teamManager, TargetingService targetingService, FloatyAreaObjectManager floatyAreaObjectManager, MessageService_ToServer messageService, IStructureManager structureManager, GameStateType stateType ) : base(messageHandlerId, clientPlayerInfoManager, networkingService, messageService, playerShipManager, stateType) { _collisionManager = collisionManager; _physicsManager = physicsManager; _projectileManager = projectileManager; _selectionManager = selectionManager; _clientShipManager = clientShipManager; _simulationManager = simulationManager; _structureFactory = structureFactoryManager; _warpholeManager = warpholeManager; _teamManager = teamManager; _targetingService = targetingService; _floatyAreaObjectManager = floatyAreaObjectManager; StructureManager = structureManager; _networkingService.RegisterMessageHandler(this, _playableStateManager_MessageReceived); }
public PlayableGameStateClient(MessageHandlerID messageHandlerId, IClientPlayerInfoManager clientPlayerInfoManager, CollisionManager collisionManager, IGlobalGameUISingleton globalGameUiSingleton, INetworkingService networkingService, PhysicsManager physicsManager, PlayerShipManager playerShipManager, ProjectileManager projectileManager, SelectionManager selectionManager, ClientShipManager clientShipManager, SimulationManager simulationManager, StructureFactoryManager structureFactoryManager, WarpHoleManager warpholeManager, TeamManager teamManager, TargetingService targetingService, FloatyAreaObjectManager floatyAreaObjectManager, MessageService_ToServer messageService, GameStateType stateType, TViewModel viewModel ) : base(messageHandlerId, clientPlayerInfoManager, networkingService, collisionManager, physicsManager, playerShipManager, projectileManager, selectionManager, clientShipManager, simulationManager, structureFactoryManager, warpholeManager, teamManager, targetingService, floatyAreaObjectManager, messageService, viewModel, stateType) { ViewModel = viewModel; WebView = (TWebView)Activator.CreateInstance(typeof(TWebView), globalGameUiSingleton, ViewModel); SetupUpdateList(_synchronousUpdateList); }
public void changeStates(GameStateType stateType) { switch (stateType) { case GameStateType.START: mCurrentState = GameStateType.START; mGameStates.Clear(); mGameStates.Add(new StartState(this)); break; case GameStateType.MENU: mCurrentState = GameStateType.MENU; mGameStates.Clear(); mGameStates.Add(new MenuState(this)); break; case GameStateType.PLAY: mCurrentState = GameStateType.PLAY; mGameStates.Clear(); mGameStates.Add(new PlayState(this)); break; case GameStateType.PAUSE: mCurrentState = GameStateType.PAUSE; mGameStates.Add(new PauseState(this)); break; case GameStateType.END: mCurrentState = GameStateType.END; mGameStates.Clear(); mGameStates.Add(new EndState(this)); break; } }
public GameStateData(GameStateType stateType, Type classType, bool defaultState, GameStateData[] subStateData = null) { this.mStateType = stateType; this.mClassType = classType; this.mDefaultState = defaultState; this.mSubStateData = subStateData; }
public static string TransformStateToString(GameStateType state) { switch (state) { case GameStateType.ChoseLevel: return("CHOSE_LEVEL"); case GameStateType.GameRunning: return("GAME_RUNNING"); case GameStateType.GamePaused: return("GAME_PAUSED"); case GameStateType.MainMenu: return("MAIN_MENU"); case GameStateType.GameOver: return("GAME_OVER"); case GameStateType.GameWon: return("GAME_WON"); default: throw new ArgumentException(); } }
private void SwitchState(GameStateType stateType) { switch (stateType) { case (GameStateType.GameRunning): ActiveState = new GameRunning(); currentGame = ActiveState; break; case (GameStateType.GamePaused): ActiveState = new GamePaused(((GameRunning)currentGame)); break; case (GameStateType.MainMenu): ((GameRunning)currentGame).Level.EndLevel(); ActiveState = MainMenu.GetInstance(); break; case (GameStateType.GameOver): ((GameRunning)currentGame).Level.EndLevel(); ActiveState = new GameOver(((GameRunning)currentGame)); break; } ActiveState.InitializeGameState(); }
public void PushState(GameStateType next, params object[] parameters) { current.OnStatePause(); states.Push(next); current = stateTypeMap[states.Peek()]; current.OnStateEnter(parameters); }
public void TriggerStateEnded(GameStateType newState) { if (OnStateEnded != null) { OnStateEnded(newState); } }
public bool PerformTransition(GameStateTransitionType transition) { Debug.Log("CallingThetransition"); Debug.Log("Transition is: " + transition); GameStateType targetStateType = CurrentState.GetTargetStateType(transition); Debug.Log("targetStateType is: " + targetStateType); if (targetStateType == GameStateType.Error) { return(false); } foreach (var state in _states) { if (state.State == targetStateType) { CurrentState.StateDeactivating(); CurrentState = state; CurrentState.StateActivated(); return(true); } } return(false); }
public void GotoState(GameStateType key) { // if this state doesn't exist, return if (!states.ContainsKey(key)) { return; } // if there is a current state, // end the state properly by calling exit if (currentState != null) { currentState.Exit(); } // remember the previous state // and set the current state previousState = currentState; CurrentStateType = key; currentState = states[CurrentStateType]; // start the new current state // by entering it currentState.Enter(); }
private void SwitchState(GameStateType stateType) { switch (stateType) { case GameStateType.MainMenu: ActiveState = MainMenu.GetInstance(); break; case GameStateType.NewGame: currentLevel = NewGame(); ActiveState = currentLevel; Player.GetInstance().ResetPlayer(); break; case GameStateType.GameRunning: ActiveState = currentLevel; break; case GameStateType.GamePaused: ActiveState = GamePaused.GetInstance(); break; case GameStateType.NextLevel: currentLevel = NextLevel(); ActiveState = currentLevel; break; } }
public static string TransformStateToString(GameStateType state) { switch (state) { case GameStateType.GameRunning: return("GAME_RUNNING"); case GameStateType.GamePaused: return("GAME_PAUSED"); case GameStateType.MainMenu: return("MAIN_MENU"); case GameStateType.GameLost: return("GAME_LOST"); case GameStateType.GameWon: return("GAME_WON"); case GameStateType.SelectLevel: return("SELECT_LEVEL"); default: throw new ArgumentException(); } }
private void SwitchState(GameStateType stateType) { switch (stateType) { case GameStateType.MainMenu: if (!Object.ReferenceEquals(ActiveState, MainMenu.GetInstance())) { ActiveState = MainMenu.GetInstance(); } break; case GameStateType.GameRunning: if (!Object.ReferenceEquals(ActiveState, GameRunning.GetInstance())) { ActiveState = GameRunning.GetInstance(); } break; case GameStateType.GamePaused: if (!Object.ReferenceEquals(ActiveState, GamePaused.GetInstance())) { ActiveState = GamePaused.GetInstance(); } break; } }
public BaseGameState(GameStateType stateType) { _synchronousUpdateList = new HashSet <ISynchronousUpdate>(); _viewUpdateList = new HashSet <ISynchronousUpdate>(); _asynchronousUpdateList = new HashSet <IAsynchronousUpdate>(); _stateType = stateType; }
protected void ProcessStateEnded(GameStateType stateType) { if (null == m_xtw) { return; } lock (this) { if (GameStateType.Game_Starting == stateType || GameStateType.Build == stateType || GameStateType.Water == stateType || GameStateType.Revenue == stateType || GameStateType.Allocation == stateType) { // System.Console.WriteLine("Processing end state {0}", stateType.ToString()); // Only write the events end element if we are dealing with a play state if (GameStateType.Build == stateType || GameStateType.Water == stateType || GameStateType.Revenue == stateType || GameStateType.Allocation == stateType) { m_xtw.WriteEndElement(); } RecordPhaseEnd(); if (GameStateType.Revenue == stateType) { RecordRoundEnd(); } } } }
public static void OnStateExit(this GameStateType state, UnityEvent ev = null) { try { ev.Invoke(); } catch (NullReferenceException e) { } switch (state) { case GameStateType.DEFAULT: break; case GameStateType.MENU: break; case GameStateType.PAUSE: Time.timeScale = 1.0f; break; case GameStateType.PLAY: break; default: break; } }
public void ChangeState(GameStateType type) { State = type; switch (type) { case GameStateType.GameStartState: ChangeState(startState); break; case GameStateType.FighterEnterState: ChangeState(fighterEnterState); break; case GameStateType.FighterOverState: ChangeState(fighterOverState); break; case GameStateType.FightingState: ChangeState(fighting); break; case GameStateType.MainState: ChangeState(mainState); break; case GameStateType.LoginState: ChangeState(loginState); break; case GameStateType.StartupAuditorState: ChangeState(startupAuditorState); break; default: throw new System.Exception(string.Format("{0} 状态不能执行!", type.ToString())); } }
//---------------------------------------------------------------------------- public void CheckLoadingType(GameStateType stateType) { eSceneType type = eSceneType.BATTLE_SCENE; switch (stateType) { case GameStateType.GST_Invaild: break; case GameStateType.GST_Main: break; case GameStateType.GST_Loading: break; case GameStateType.GST_Login: break; case GameStateType.GST_Update: break; case GameStateType.GST_Logo: break; case GameStateType.GST_Lobby: type = eSceneType.LOBBY_SCENE; break; default: type = eSceneType.BATTLE_SCENE; break; } Messenger.Broadcast(DgMsgID.DgMsg_ShowLoadingUIByType, type); }
public void ToMainMenu() { GameManager.comboCount = 0; GameStateManager.Instance.ChangeState( (GameStateType)GameStateType.Parse(typeof(GameStateType) , MainMenu)); }
private static void GuessCharacter() { List <char> possibleCharacters = new List <char>(); foreach (var word in possibleWords) { possibleCharacters.AddRange(word.ToCharArray()); } possibleCharacters = possibleCharacters.Distinct(). Where(x => false == guessedCharacters.Contains(x)).ToList(); if (possibleCharacters.Count == 1) { currentGuessChar = possibleCharacters.ElementAt(0); for (int i = 0; i < currentGuessWord.Count; i++) { if (currentGuessWord[i] == '_') { currentGuessWord[i] = currentGuessChar; } } gameState = GameStateType.FinishWord; return; } var guessedChar = new Random().Next(0, possibleCharacters.Count); currentGuessChar = possibleCharacters[guessedChar]; }
private void ChangeUpPanelState(GameStateType gameType) { foreach (var upPanel in _upPanels) { var upPosition = new Vector3( upPanel.transform.localPosition.x, _panelsUpPosition, upPanel.transform.localPosition.z); var targetPosition = new Vector3( upPanel.transform.localPosition.x, _panelsTargetPosition, upPanel.transform.localPosition.z); switch (gameType) { case GameStateType.Gamestart: upPanel.transform.localPosition = upPosition; break; case GameStateType.Gameplay: upPanel.SetActive(true); upPanel.transform.localPosition = upPosition; Animation(upPanel.transform, targetPosition); break; case GameStateType.Gameover: // var uptween = Animation(upPanel.transform, upPosition); // uptween.OnKill(()=> {/*upPanel.SetActive(false);*/}); break; } } }
public void SwitchState(GameStateType stateType) { switch (stateType) { case GameStateType.GameRunning: ActiveState = GameRunning.GetInstance(); break; case GameStateType.GamePaused: ActiveState = GamePaused.GetInstance(); break; case GameStateType.MainMenu: ActiveState = MainMenu.GetInstance(); break; case GameStateType.GameLost: ActiveState = GameLost.GetInstance(); break; case GameStateType.GameWon: ActiveState = GameWon.GetInstance(); break; } }
void InitGame() { mCurrentState = GameStateType.InitState; mTextureFog.UpdateFog(transform.position, 1); started = true; }
public void ChangeState(GameStateType pState) { if (SceneManager.Instance.IsSceneLoadiing()) { Debuger.Log("System busy"); return; } if (null != m_CurrentStage) { m_CurrentStage.EndStage(); } m_CurrentStage = null; if (!m_StageHandlerStore.TryGetValue(pState, out m_CurrentStage)) { m_CurrentStage = Activator.CreateInstance(m_StageHandlerFactoryStore[pState], pState) as StageBase; m_StageHandlerStore.Add(pState, m_CurrentStage); } Time.timeScale = 1.0f; //send msg MessageDispatcher.Instance.BroadcastMessage(new MessageObject(ClientCustomMessageDefine.C_CHANGE_SCENE, null)); //load scene SceneManager.Instance.LoadScene(m_StageSceneStore[pState], m_CurrentStage.StartStage, m_CurrentStage.PreLoadScene, m_CurrentStage.InitStage); }
public void RaiseGameStateChangingEvent(GameStateType stateType) { if (GameStateChanging != null) { GameStateChanging(stateType); } }
public void SetState(GameStateType stateType, bool forceEnter = false) { // 记录oldStateType防死循环 GameState oldState = currentState; GameState newState = null; if (!states.TryGetValue(stateType, out newState)) { return; } currentState = newState; if (oldState != currentState) { if (oldState != null) { oldState.OnExit(context); } if (newState != null) { newState.OnEnter(context); } } }
public void RaiseGameStateChangedEvent(GameStateType stateType) { if (GameStateChanged != null) { GameStateChanged(stateType); } }
public void SetGameState(GameStateType type) { if (GameStates.TryGetValue(type, out var state)) { SetGameState(state); } }
public void OnEvent(CEvent evt) { switch (evt.GetEventId()) { case EGameEvent.eGameEvent_Loading: { GameStateType stateType = (GameStateType)evt.GetParam("NextState"); LoadingState lState = GameStateManager.Instance.getState(GameStateType.GS_Loading) as LoadingState; lState.SetNextState(stateType); lState.SetFrontScenes(View.EScenesType.EST_Play); SetStateTo(GameStateType.GS_Loading); } break; case EGameEvent.eGameEvent_IntoRoom: { LoadingState lState = GameStateManager.Instance.getState(GameStateType.GS_Loading) as LoadingState; lState.SetNextState(GameStateType.GS_Room); lState.SetFrontScenes(View.EScenesType.EST_Play); SetStateTo(GameStateType.GS_Loading); } break; case EGameEvent.eGameEvent_IntoLobby: { LoadingState lState = GameStateManager.Instance.getState(GameStateType.GS_Loading) as LoadingState; lState.SetNextState(GameStateType.GS_Lobby); lState.SetFrontScenes(View.EScenesType.EST_Play); SetStateTo(GameStateType.GS_Loading); } break; } }
public Game(UUID uuid, string name, GameStateType state) : base(uuid, name) { State = state; Roles = new List<IRole>(); BuyPoints = new Dictionary<UUID, BuyPoint>(); Players = new Dictionary<UUID, Player>(); GameAssets = new Dictionary<UUID, AbstractGameAsset>(); }
public void Exit() { if (_state == GameStateType.RUNNING) { _state = GameStateType.ABORTING; _gameLogic.Join(); _gameLogic = null; _state = GameStateType.NOT_STARTED; } }
/// <summary> /// Gets the game state registered with the given state type (if one is registered). /// </summary> /// <param name="type"></param> /// <returns></returns> public GameState this[GameStateType type] { get { if (stateTypes.ContainsKey(type)) { return stateTypes[type]; } return null; } }
public void Reset() { survival = new TimeSpan(); dying = new TimeSpan(); Player = new Player(); Player.Initialize(game, this); Energy = new Energy(); Energy.Initialize(game); Asteroids = new Asteroids(); Asteroids.Initialize(game); State = GameStateType.Playing; }
public IEnumerator PlaySong() { gameState = GameStateType.AutomaticPlay; yield return new WaitForSeconds(1.0f); for (int x = 0; x <myList.Count ; x ++) { buttonList[myList[x]].GetComponent<MoveWhenPressed>().PressButton(); yield return new WaitForSeconds(1.0f); buttonList[myList[x]].GetComponent<MoveWhenPressed>().ReleaseButton(); yield return new WaitForSeconds(0.5f); } gameState = GameStateType.PlayerInput; }
private void NewGameState(GameStateType newState) { // (1) state EXIT actions OnMyStateExit(currentState); // (2) change current state currentState = newState; // (3) state ENTER actions OnMyStateEnter(currentState); PostMessageDivider(); }
public void OnBtnPaused() { //If you are already paused, return to gameplay. if (GameState == GameStateType.Paused) { GameState = GameStateType.Gameplay; ScrGameplay.SetActive (true); ScrPaused.SetActive (false); } else { if (GameState == GameStateType.Gameplay) GameState = GameStateType.Paused; ScrGameplay.SetActive (false); ScrPaused.SetActive (true); } }
void OnLevelWasLoaded(int level) { if (level == 1){ GameState = GameStateType.PlayingVsPlayer; if(positionInGame == "down"){ Player1.tag = "Player"; Player2.tag = "Enemy"; } else { Player2.tag = "Player"; Player1.tag = "Enemy"; } SetPosition += delegate(string type, Vector3 pos) { if (type == "t") enemy().transform.position = pos; else if (type == "b") Ball.transform.position = pos; }; } }
private void NewGameState(GameStateType newState) { // (1) state EXIT actions switch( currentState ) { case GameStateType.STATE_GAME_PLAYING: gameStartTime = Time.time; break; } // (2) change current state currentState = newState; // (3) state ENTER actions }
/* * @brief 胜利 * @desc 修改游戏状态 * @desc 不可再发射泡泡:发射器内部实现 * @desc 弹出胜利页面 */ public IEnumerator GameWinFunction() { if (popBuyStepObject != null) { Destroy(popBuyStepObject); } //保存数据 PlayUIScript.Instance.SaveInfoToUserInstance(); gameCurrentState = GameStateType.GAME_STATE_WIN; yield return new WaitForSeconds(0.2f); //弹出胜利的页面 GameObject winDlg = Instantiate(winDlgGameObject) as GameObject; winDlg.transform.parent = uiRootGameObject.transform; winDlg.transform.localScale = new Vector3(1.0f, 1f, 1f); }
public static StageBase StageHandlerFactory(GameStateType type) { switch (type) { case GameStateType.LoginState: return new LoginStage(type); case GameStateType.MainCityState: return new MaincityStage(type); case GameStateType.BattleState: return new BattleStage(type); case GameStateType.ReConnect: return new BattleStage(type); } Debuger.LogError("unkunow game stage type : " + type); return null; }
/* * @brief 当游戏结束的时候执行函数 */ public IEnumerator GameOverFunction() { //保存数据 PlayUIScript.Instance.SaveLoseInfoToUserInstance(); //修改游戏状态 gameCurrentState = GameStateType.GAME_STATE_GAMEOVER; //所有泡泡,全部自由落体,滑板不再下落 PlayLogic.Instance.FallDownAllPubble(); yield return new WaitForSeconds(0.5f); Debug.Log("弹出失败的页面------------------"); //弹出失败的页面 GameObject loseDlg = Instantiate(loseDlgGameObject) as GameObject; loseDlg.transform.parent = uiRootGameObject.transform; loseDlg.transform.localScale = new Vector3(1.0f,1f,1f); }
//--------- OnMyStateEnter[ S ] - state specific actions --------- private void OnMyStateEnter(GameStateType state) { string enterMessage = "ENTER state: " + state.ToString(); PostMessage(enterMessage); switch (state){ case GameStateType.GamePlaying: OnMyStateEnterGamePlaying(); break; case GameStateType.GameWon: // do nothing break; case GameStateType.GameLost: // do nothing break; } }
public void WarningFeature(GameStateType state, FeatureContext source, FeatureContext target) { if (state == GameStateType.Race) { if (source.tire != target.tire) { noteTire.text = target.tire.ToString(); noteTire.color = Color.red; } if (source.brake != target.brake) { noteBrake.text = target.brake.ToString(); noteBrake.color = Color.red; } if (source.gearbox != target.gearbox) { noteGearbox.text = target.gearbox.ToString(); noteGearbox.color = Color.red; } if (source.body != target.body) { noteBody.text = target.body.ToString(); noteBody.color = Color.red; } if (source.motor != target.motor) { noteMotor.text = target.motor.ToString(); noteMotor.color = Color.red; } if (source.handling != target.handling) { noteHandling.text = target.handling.ToString(); noteHandling.color = Color.red; } } else if (state == GameStateType.Qualification) { if (source.outOfBend != target.outOfBend) { notePenalty.text = target.outOfBend.ToString(); notePenalty.color = Color.red; } } }
public void UpdateFeature(GameStateType state, FeatureContext feature, int bendStop, int maxBendStop) { var currentBendStop = bendStop; if (bendStop > maxBendStop) { currentBendStop = maxBendStop; } if (state == GameStateType.Race) { panelRaceFeature.gameObject.SetActive(true); panelQualificationFeature.gameObject.SetActive(false); noteTire.text = feature.tire.ToString(); noteTire.color = Color.black; noteBrake.text = feature.brake.ToString(); noteBrake.color = Color.black; noteGearbox.text = feature.gearbox.ToString(); noteGearbox.color = Color.black; noteBody.text = feature.body.ToString(); noteBody.color = Color.black; noteMotor.text = feature.motor.ToString(); noteMotor.color = Color.black; noteHandling.text = feature.handling.ToString(); noteHandling.color = Color.black; noteBend.text = string.Format("{0}/{1}", currentBendStop, maxBendStop); } else if (state == GameStateType.Qualification) { panelRaceFeature.gameObject.SetActive(false); panelQualificationFeature.gameObject.SetActive(true); notePenalty.text = feature.outOfBend.ToString(); notePenalty.color = Color.black; noteQualificationBend.text = string.Format("{0}/{1}", currentBendStop, maxBendStop); } }
public void TwoPair(ICharacter character, int call, ISingleBet bet, int raise, GameStateType state) { int randomCall = this.random.GetRandomNumberInInterval(6, 11); int randomRaise = this.random.GetRandomNumberInInterval(6, 11); if (character.CharacterType.Power <= 290 && character.CharacterType.Power >= 246) { this.type.PH(character, randomCall, 3, randomRaise, call, bet, raise, state); } if (character.CharacterType.Power <= 244 && character.CharacterType.Power >= 234) { this.type.PH(character, randomCall, 4, randomRaise, call, bet, raise, state); } if (character.CharacterType.Power < 234 && character.CharacterType.Power >= 201) { this.type.PH(character, randomCall, 4, randomRaise, call, bet, raise, state); } }
public void PairHand(ICharacter character, int call, ISingleBet bet, int raise, GameStateType state) { int randomCall = this.random.GetRandomNumberInInterval(10, 16); int randomRaise = this.random.GetRandomNumberInInterval(10, 13); if (character.CharacterType.Power <= 199 && character.CharacterType.Power >= 140) { this.type.PH(character, randomCall, 6, randomRaise, call, bet, raise, state); } if (character.CharacterType.Power <= 139 && character.CharacterType.Power >= 128) { this.type.PH(character, randomCall, 7, randomRaise, call, bet, raise, state); } if (character.CharacterType.Power < 128 && character.CharacterType.Power >= 101) { this.type.PH(character, randomCall, 9, randomRaise, call, bet, raise, state); } }
public void LoadPlayer(PlayerSettings player, GameStateType gameState, int index) { if (player == null) { this.gameObject.SetActive(false); } else { this.gameObject.SetActive(true); nameText.text = player.name; image.color = new Color(1, 1, 1, 1); if (player.isDead) { image.sprite = deadSprite; } else if (gameState == GameStateType.Completed) { if (index == 0) { image.sprite = winnerSprite; } else { image.sprite = null; image.color = new Color(1, 1, 1, 0); } } else if (player.isCurrent) { image.sprite = currentSprite; } else { image.sprite = null; image.color = new Color(1, 1, 1, 0); } } }
public Regularity2DStage(GameStateType type) : base(type) { }
public MusicGameStage(GameStateType type) : base(type) { }
public SelectSceneStage(GameStateType type) : base(type) { }
public void Run() { SettingsLoader.ProcessGameData(); SettingsLoader.ProcessApt(); using (Stream iconStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("OpenSAGE.nod.ico")) { _mainWindow = new RenderForm("Open SAGE Debug") { Icon = new Icon(iconStream), StartPosition = FormStartPosition.CenterScreen, Width = 1280, Height = 720, }; } _mainWindow.Shown += new EventHandler(ExecuteMainWindowShown); _mainWindow.FormClosing += new FormClosingEventHandler(ExecuteMainWindowClose); _renderer = new Renderer(); _renderer.Initialize(_mainWindow.Handle, _mainWindow.ClientSize.Width, _mainWindow.ClientSize.Height); _renderer.Load(); Application.Idle += new EventHandler(ExecuteApplicationIdle); SetCursor(GlobalData.MouseArrow); _gameLogic = new Thread(new ThreadStart(LogicThread)); _gameLogic.Name = "OpenSAGE GameLogic Thread"; _gameLogic.Start(); _visual = new Thread(new ThreadStart(VisualThread)); _visual.Name = "OpenSAGE Visual Thread"; _visual.Start(); _state = GameStateType.RUNNING; Application.Run(_mainWindow); }
private void Initialize() { _state = GameStateType.LOADING; }
private IEnumerator GoToGameState(GameStateType gameStateType) { yield return StartCoroutine(CleanUpCurrentScene()); GameStateManager.instance.PushGameState(gameStateType); }
public Copenhagen01Stage(GameStateType type) : base(type) { }
// Use this for initialization void Start() { Debug.Log("level: " + Application.loadedLevel); Balls = new List<GameObject>(); Network.ServerMsg += delegate(Network.NetworkMsg ms) { switch (ms.type) { case "connected": if (ServerConnect != null) ServerConnect(); clientId = ms.id; GameState = GameStateType.ConnectedToServer; Loom.QueueOnMainThread(()=>{ if (ServerConnect != null) ServerConnect(); }); break; case "foundMatch": Debug.Log("Found match against" + ms.msg); enemyId = ms.msg.Split('|')[0]; positionInGame = ms.msg.Split('|')[1]; Loom.QueueOnMainThread(()=>{ Application.LoadLevel("lvlMultiplayers"); }); break; case "position": Loom.QueueOnMainThread(()=>{ if (SetPosition != null) SetPosition(ms.msg.Split('|')[0], new Vector3(float.Parse(ms.msg.Split('|')[1]), float.Parse(ms.msg.Split('|')[2]), 0)); }); break; case "enemyLeft": Debug.Log("enemy left game"); GameState = GameStateType.Start; Loom.QueueOnMainThread(()=>{ Application.LoadLevel("lvl1"); }); break; default: Debug.Log("unknown server response"); break; } }; Network.ServerDisonnect += () => {}; Network.ServerDisonnect += () => { Loom.QueueOnMainThread(()=>{ Application.LoadLevel("lvl1"); }); }; }
public void TriggerStateStarted(GameStateType newState) { if (OnStateStarted != null) OnStateStarted(newState); }
public DrawGameStage(GameStateType type) : base(type) { }