/// <summary> /// Change the current GameMode /// </summary> /// <param name="newGameMode">New GameMode to set</param> public void ChangeGameMode(GameMode newGameMode) { if (m_gameMode != null) { m_gameMode.Disable(); } m_gameMode = Instantiate(newGameMode); m_gameModeEnabled = true; m_currentGameModeState = GameModeState.Idle; }
void Update() { if (State == GameModeState.PreGame) { //If the pregame time runs out start the gamemode if (RemainingTime <= 0f) { State = GameModeState.Gameplay; PrepareForStart(); StartGameMode(); if (EnablePickUps) { Pm.Enable(); } } //Designed for Local play. Checks if a player wants to join or drop out during pregame if (PhotonNetwork.offlineMode) { for (var i = 0; i < TribotInput.InputCount; i++) { if (TribotInput.GetButtonDown(TribotInput.InputButtons.Start, i)) { if (!Players.Any(x => !x.Ai && x.InputIndex == i)) { var player = Players.First(x => x.Ai); player.Ai = false; player.InputIndex = i; player.CreatePlayer(PField.GetSpawnLocation(player.Index)); } } if (TribotInput.GetButtonDown(TribotInput.InputButtons.Back, i)) { if (Players.Any(x => !x.Ai && x.InputIndex == i)) { var player = Players.First(x => !x.Ai && x.InputIndex == i); player.Ai = true; player.CreatePlayer(PField.GetSpawnLocation(player.Index)); } } } } } if (State == GameModeState.Gameplay) { ExtendedUpdate(); } }
public void Ready() { if (state == GameModeState.Ready) { return; } state = GameModeState.Ready; ReadyTime = Timing.sInstance.GetFrameStartTime(); Dirty((uint)ReplicationState.GameState); LogHelper.LogInfo($"GameMode Ready worldid:{WorldId}, networkid:{GetNetworkId()}, timestamp:{Timing.sInstance.GetFrameStartTime()}"); }
private void StartMenuButtonPress() { if (ButtonHandler.StartFreeButton) { ButtonHandler.StartFreeButton = false; RunStart(true); } else if (ButtonHandler.StartLadderButton) { ButtonHandler.StartLadderButton = false; RunStart(false); } else if (ButtonHandler.BackgroundButton) { if (!FileBrowser.IsOpen) { CurrentGameModeState = GameModeState.FileSearching; FileBrowser.ShowLoadDialog((path) => { StartCoroutine(WaitForDownload(path)); }, null, false, FileBrowser.Result); } ButtonHandler.BackgroundButton = false; } else if (ButtonHandler.HelpButton) { CurrentGameModeState = GameModeState.Info; ButtonHandler.HelpButton = true; _helpText.gameObject.SetActive(true); _scoreboardScript.EnableScoreboardGui(false); } else if (ButtonHandler.CreditsButton) { CurrentGameModeState = GameModeState.Info; ButtonHandler.CreditsButton = true; _creditsText.SetActive(true); _scoreboardScript.EnableScoreboardGui(false); } if (ButtonHandler.GradientButton) { CurrentGameModeState = GameModeState.GradientMode; } else if (CurrentGameModeState == GameModeState.GradientMode && !ButtonHandler.GradientButton) { CurrentGameModeState = GameModeState.Start; } }
public void SetGameState(GameModeState newState) { if (_currentGameState == newState) { return; } Debug.Log($"## Changing game state from: {_currentGameState} to: {newState} in progress ##"); switch (newState) { case GameModeState.NONE: break; case GameModeState.TO_MAIN_MENU_FROM_LOADER: break; case GameModeState.PAUSE: break; case GameModeState.TO_GAME_FROM_MAIN_MENU: break; case GameModeState.TO_NEXT_LEVEL: break; case GameModeState.IN_MAIN_MENU: break; case GameModeState.IN_GAME: if (!CanInGame) { return; } break; } _currentGameState = newState; GameStateChanged(); }
private int transition_finished_cnt; //transition count of finish state; till 9 for example; private void Awake() { IS = this; chestg_scale = 1.0f; chestg_pos_list = new List <Vector3>(); curr_deno = 0.0f; curr_deno_i = 0; curr_balance = 0.0f; receive_Mcast = false; hovering_id = -1; curr_GMstate = GameModeState.Default; predict_multi = 0.0f; total_pred_reward = 0.0f; curr_chest_reward_index = 0; curr_win = 0; chest_reward_arr = new float[0]; chest_ani_tier_arr = new float[0]; closeallchest_ani_coro = null; transition_finished_cnt = 0; }
public void StartPlay(List <int> players) { StartEpochTime = DateTime.UtcNow.ToEpochTime(); StartTime = Timing.sInstance.GetFrameStartTime(); IsSetPlayTime = true; Dirty((uint)ReplicationState.PlayTime); state = GameModeState.Play; Dirty((uint)ReplicationState.GameState); LogHelper.LogInfo($"GameMode Start worldid:{WorldId}, networkid:{GetNetworkId()}, timestamp:{Timing.sInstance.GetFrameStartTime()}"); foreach (var player in World.Instance(WorldId).playerList) { player.Value.InvokeClientRpcOnClient(player.Value.OnStartPlay, player.Key, players); } game_mode.OnStartPlay(this); // 게임 시작 이벤트 호출 OnStart?.Invoke(); }
// Update is called once per frame void Update() { // Change state? if (State == GameModeState.InProgress) { foreach (ObjectiveBS obj in OBJECTIVES) { switch (obj.objType) { case ObjectiveBS.ObjType.WinLevel: if (obj.finishedObjective == true) { print("WIN LEVEL!"); State = GameModeState.Victory; } break; case ObjectiveBS.ObjType.LoseLevel: if (obj.finishedObjective == true) { print("LOSE LEVEL!"); State = GameModeState.Defeat; } break; case ObjectiveBS.ObjType.QuitLevel: if (obj.finishedObjective == true) { print("QUIT LEVEL!"); State = GameModeState.Quit; } break; default: break; } } } }
public virtual void Initialize(Playfield pf) { IsFinished = false; PField = pf; Players = Container <IPlayerManager> .Instance.Items; PlayerScores = new Dictionary <int, float>(); for (var i = 0; i < Players.Count; i++) { PlayerScores.Add(Players[i].Index, 0f); Players[i].CreatePlayerCallback += PlayerCreated; //Players[i].CreatePlayer(PField.GetSpawnLocation(i)); } Pm = PickUpManager.Instance; Pm.PickUpInterval = PickUpInterval; Pm.BorderLayer = _data.BorderLayer; Pm.GroundLayer = _data.GroundLayer; _startTime = Time.time + _data.PreGameDuration; InstantiateUi(); State = GameModeState.PreGame; }
/// <summary> /// Generates a new block depending on the game mode /// </summary> /// <param name="_gameMode">The game mode or combination of game modes</param> /// <param name="_blockType">The type of block to spawn. '0' spawns: 2 in Twos mode, 3 in Threes mode and '1' spawns: 4 in Twos mode, 6 in Threes mode</param> /// <returns></returns> public static int GenerateNewBlock(GameModeState _gameMode, int _blockType) { //Depending on the game mode, we will generate the appropriate block int splitChance = -1; //if on both Twos and Threes mode at the same time, we will use this to generate a block from either set if (_gameMode == (GameModeState.Threes | GameModeState.Twos)) { splitChance = randy.Next(0,10); //0-4 will be a block from Twos and 5-10 will be a block from Threes } if (_gameMode == GameModeState.Twos || (splitChance >= 0 && splitChance < 5)) { if (_blockType < 1) { return 2; } else { return 4; } } else if (_gameMode == GameModeState.Threes || (splitChance >= 5 && splitChance <= 10)) { if (_blockType < 1) { return 3; } else { return 6; } } return 2; //this shouldn't happen though. }
void StartingMode() { switch (startingDone) { case false: //Ne faire qu'une seule fois au lancement inGameUI.FadeToBlack(false, 1f); ModeStartingStart(); startingDone = true; break; case true: //A la fin du fade, changer de mode //Ajouter Activation des personnages if (!inGameUI.isFading) { gameModeState = GameModeState.Playing; } //Repeter pendant qu'on reste dans ce mode ModeStartingUpdate(); break; } }
/// <summary> /// Update GameModes and analyze the status. /// </summary> private void UpdateGameMode() { /// if there's a gameMode and it is enabled /// it can start analyze its status. if (m_gameMode != null && m_gameModeEnabled) { /// if current recorded status is Idle, then check /// again to update. Otherwise, disable the gameMode /// marking it as disabled and throw an event. if (m_currentGameModeState == GameModeState.Idle) { m_currentGameModeState = m_gameMode.CheckGameModeCondition(); } else { m_gameModeEnabled = false; if (OnGameModeEndsEvent != null) { OnGameModeEndsEvent(m_currentGameModeState); } } } }
private void HoldQuitTimer() { if (!_quitBar.gameObject.activeSelf) { _quitBar.gameObject.SetActive(true); } _holdQuitTick += Time.unscaledDeltaTime; if (_holdQuitTick >= _holdQuitTime) { _holdQuitTick = 0; ButtonHandler.QuitButton = false; _quitBar.localScale = _quitBarSize; _quitBar.gameObject.SetActive(false); if (CurrentGameModeState == GameModeState.Gameplay) { if (Time.timeScale != 1) { Time.timeScale = 1; } CurrentGameModeState = GameModeState.Start; CurrentPlayMode = PlayMode.None; _scoreboardScript.ResetStats(); ButtonHandler.DisableAllButtons(); _titleAnimationScript.Enable(true); SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); } else if (CurrentGameModeState == GameModeState.Info) { CurrentGameModeState = GameModeState.Start; if (_helpText.activeSelf) { ButtonHandler.HelpButton = false; _helpText.SetActive(false); } else if (_creditsText.activeSelf) { ButtonHandler.CreditsButton = false; _creditsText.SetActive(false); } _scoreboardScript.EnableScoreboardGui(true); } else { Application.Quit(); } } else { float scale = (Screen.width / _holdQuitTime) * Time.unscaledDeltaTime; _quitBar.localScale += new Vector3(scale, 0); } }
/// <summary> /// Start the calling state; /// </summary> public void ToCalling() { curr_GMstate = GameModeState.Calling; toggle_lock_CGroups(true); callingState_reset(); }
//Une fois que tout est charge et que le niveau peut etre lance public void GameStart() { //Initiation de la stateMachine gameModeState = GameModeState.Starting; }
public extern void orig_InitializeBrushBehaviour(GameModeState state);