void TransitionManager_RequestStartGame(string _transitionSerial) { var _transition = new GameTransition(); NetworkSerializer.Deserialize(_transitionSerial, out _transition); StartGameLocal(_transition); }
// Use this for initialization void Start() { _player = GameObject.Find("Player"); _player.tag = "Untagged"; _playerFemale = GameObject.Find("PlayerFemale"); _playerFemale2 = GameObject.Find("PlayerFemale2"); _startPlayerPos = _player.transform.position; _startPlayerRot = _player.transform.rotation; _startPlayerFemale2Pos = _playerFemale2.transform.position; _startPlayerFemale2Rot = _playerFemale2.transform.rotation; _playerBad = GameObject.Find("PlayerBad"); _playerBad.SetActive(false); _infoImage = GameObject.Find("InfoImage"); _infoImage.SetActive(false); _particleManager = GameObject.Find("ParticleManager").GetComponent <ParticleManager>(); _infoText = _infoImage.transform.GetChild(0).GetComponent <Text>(); _introSkipped = false; _controlsPanel = GameObject.Find("ControlsPanel"); _controlsPanel.SetActive(false); _controlsShown = false; ShowMessage("If you cannot stand the intro press Space to skip", Color.black, 4.5f); _particleManager.GetParticleSystem("Player").Play(); _particleManager.GetParticleSystem("PlayerFemale").Play(); _gameTransition = GameTransition.GtCameraDown; }
public void RequestStartGame(GameTransition _transition) { if (!Network.isServer) { Debug.Log("Only server can start the game!"); return; } networkView.RPC("TransitionManager_RequestStartGame", RPCMode.All, NetworkSerializer.Serialize(_transition)); }
public void RequestStartGame(GameTransition _transition) { if (! Network.isServer) { Debug.Log("Only server can start the game!"); return; } networkView.RPC("TransitionManager_RequestStartGame", RPCMode.All, NetworkSerializer.Serialize(_transition)); }
void StartGame() { var _mode = new GameModeTestDef().TestLevel("test_map_kkh001"); _mode.overrideMode = true; var _transition = new GameTransition() .Map(map) .Mode(_mode); Global.Transition().RequestStartGame(_transition); }
void Awake() { if (instance == null) { instance = this; } else { GameObject.Destroy(instance.gameObject); instance = this; } }
/// <summary> /// Makes transition to another state. /// </summary> /// <param name="triggerType"></param> /// <param name="payload"></param> /// <returns></returns> public bool Trigger(GameTransition triggerType, Dictionary <string, object> payload = null) { switch (triggerType) { case GameTransition.ResumePlaying: if (currentState == GameState.Play || currentState == GameState.Menu) { TransitionTo(GameState.Play, payload); return(true); } return(false); case GameTransition.PausePlaying: if (currentState == GameState.Play) { TransitionTo(GameState.Menu, payload); return(true); } return(false); case GameTransition.ShowGameOver: if (currentState == GameState.Play) { TransitionTo(GameState.GameOver, payload); return(true); } return(false); case GameTransition.ShowLevelSuccess: if (currentState == GameState.Play) { TransitionTo(GameState.LevelSuccess, payload); return(true); } return(false); case GameTransition.ShowWinningScreen: if (currentState == GameState.Play) { TransitionTo(GameState.Winning, payload); return(true); } return(false); default: throw new NotImplementedException(); } }
void Awake() { // Singleton pattern. if (Instance != null) { Destroy(this.gameObject); } Instance = this; DontDestroyOnLoad(this.gameObject); this.isLoading = false; this.isZooming = false; }
void StartGameLocal(GameTransition _transition) { Application.LoadLevel(_transition.map); if (_transition.setupDelay < 0) { Debug.Log("Trying to setup GameMode without delay. Sure?"); SetupGame(); } else { m_GameTransition = _transition; Invoke("SetupGame", m_GameTransition.setupDelay); } }
void StartGame() { if (!Global.GameSetting().valid) { Debug.LogWarning("GameSetting is not valid."); return; } var _map = Global.GameSetting().map; var _mode = Global.GameSetting().modeSelected; _mode.overrideMode = true; var _transition = new GameTransition() .Map(_map) .Mode(_mode); Global.Transition().RequestStartGame(_transition); }
void SkipIntro() { if (_introSkipped) { return; } Camera.main.transform.position = _firstCameraCheckPoint; DestroyHeartParticles(); _playerBad.SetActive(false); _playerFemale.SetActive(false); _player.tag = "Player"; HideMessage(); _gameTransition = GameTransition.GtMainGame; _introSkipped = true; GetComponent <AudioSource>().clip = AmbientClips[1]; GetComponent <AudioSource>().Play(); }
void StartGameLocal(GameTransition _transition) { Global.Level.Load(_transition.map); Game.Progress.TryIntroGame(); if (_transition.setupDelay < 0) { Debug.Log("Trying to setup GameMode without delay. Sure?"); SetupGame(); } else { m_GameTransition = _transition; Invoke("SetupGame", m_GameTransition.setupDelay); } if (gameCutScene) { Instantiate(gameCutScene); } }
void SetupGame() { m_GameTransition.Setup(); m_GameTransition = null; Global.Context ().context = ContextType.GAME; }
void StartGameLocal(GameTransition _transition) { Global.Level.Load(_transition.map); Game.Progress.TryIntroGame(); if (_transition.setupDelay < 0) { Debug.Log("Trying to setup GameMode without delay. Sure?"); SetupGame(); } else { m_GameTransition = _transition; Invoke("SetupGame", m_GameTransition.setupDelay); } if (gameCutScene) Instantiate(gameCutScene); }
public void StartEndingSequence() { _gameTransition = GameTransition.GtMainGameDone; }
// Update is called once per frame void Update() { _msgDt -= Time.smoothDeltaTime; //_player.transform.position = _startPlayerPos; switch (_gameTransition) { case GameTransition.GtCameraDown: Camera.main.transform.position = Vector3.Lerp(Camera.main.transform.position, _firstCameraCheckPoint, 0.5f * Time.smoothDeltaTime); _player.transform.position = _startPlayerPos + new Vector3(Mathf.PingPong(Time.time, 0.5f), 0, 0); _player.transform.rotation = _startPlayerRot; if (MessageEnded) { HideMessage(); } if (Vector3.Distance(Camera.main.transform.position, _firstCameraCheckPoint) < 0.1f) { _gameTransition = GameTransition.GtCameraDownDone; } break; case GameTransition.GtCameraDownDone: Camera.main.transform.position = _firstCameraCheckPoint; _gameTransition = GameTransition.GtCuGoodLoveLine; ShowMessage("Cugood: Ahhh... Pssstfffs mouts mouts", Color.blue, 2.5f); AudioSource.PlayClipAtPoint(DialogClips[0], Camera.main.transform.position, 0.5f); break; case GameTransition.GtCuGoodLoveLine: if (MessageEnded) { _gameTransition = GameTransition.GtCuGoodLoveLineDone; } break; case GameTransition.GtCuGoodLoveLineDone: Camera.main.transform.position = _firstCameraCheckPoint; _gameTransition = GameTransition.GtCutieLoveLine; ShowMessage("Cutie: Ahhh... Pssstfffs mouts mouts", Color.magenta, 2.5f); AudioSource.PlayClipAtPoint(DialogClips[1], Camera.main.transform.position, 0.5f); break; case GameTransition.GtCutieLoveLine: if (MessageEnded) { _gameTransition = GameTransition.GtCutieLoveLineDone; } break; case GameTransition.GtCutieLoveLineDone: Camera.main.transform.position = _firstCameraCheckPoint; DestroyHeartParticles(); _gameTransition = GameTransition.GtCubadComing; EnableCubad(); AudioSource.PlayClipAtPoint(DialogClips[2], Camera.main.transform.position, 0.5f); ShowMessage("Cubad: Sorry for interrupting", Color.black, 4.0f); GetComponent <AudioSource>().clip = AmbientClips[0]; GetComponent <AudioSource>().Play(); _player.transform.GetChild(2).GetComponent <Rigidbody>().AddForce(10 * Vector3.left, ForceMode.Impulse); _playerFemale.transform.GetChild(3).GetComponent <Rigidbody>().AddForce(10 * Vector3.right, ForceMode.Impulse); break; case GameTransition.GtCubadComing: _playerBad.transform.GetChild(0).GetComponent <Rigidbody>().velocity = Vector3.up; if (MessageEnded) { _gameTransition = GameTransition.GtCubadComingDone; } break; case GameTransition.GtCubadComingDone: ShowMessage("Cubad: I will take this beautiful lady just because I can", Color.black, 4.0f); AudioSource.PlayClipAtPoint(DialogClips[2], Camera.main.transform.position, 0.5f); _gameTransition = GameTransition.GtCubadTaking; break; case GameTransition.GtCubadTaking: _playerBad.transform.GetChild(0).GetComponent <Rigidbody>().velocity = Vector3.up * 1.0f; _playerFemale.transform.GetChild(0).GetComponent <Rigidbody>().velocity = Vector3.up * 2.5f; if (MessageEnded) { _gameTransition = GameTransition.GtCubadTakingDone; } break; case GameTransition.GtCubadTakingDone: ShowMessage("Cutie: Ahhh! Help me Cugood!", Color.magenta, 2.5f); AudioSource.PlayClipAtPoint(DialogClips[3], Camera.main.transform.position, 0.5f); _gameTransition = GameTransition.GtCubadGoing; break; case GameTransition.GtCubadGoing: _playerBad.transform.GetChild(0).GetComponent <Rigidbody>().velocity = (Vector3.up + 2.5f * Vector3.right) * 2.5f; _playerFemale.transform.GetChild(0).GetComponent <Rigidbody>().velocity = (Vector3.up + 2.5f * Vector3.right) * 2.5f; if (MessageEnded) { _gameTransition = GameTransition.GtCubadGoingDone; } break; case GameTransition.GtCubadGoingDone: _playerBad.SetActive(false); _playerFemale.SetActive(false); ShowMessage("Cugood: Nooooo !!! I' ll find you! Even if you somehow can fly and I can't...", Color.blue, 6.0f); AudioSource.PlayClipAtPoint(DialogClips[4], Camera.main.transform.position, 0.5f); _player.transform.GetChild(0).GetComponent <Rigidbody>().AddForce(50 * Vector3.up, ForceMode.Impulse); _gameTransition = GameTransition.GtCugoodCry; break; case GameTransition.GtCugoodCry: if (MessageEnded) { _gameTransition = GameTransition.GtCugoodCryDone; } break; case GameTransition.GtCugoodCryDone: HideMessage(); _player.tag = "Player"; _gameTransition = GameTransition.GtMainGame; SkipIntro(); //Game sound starts break; case GameTransition.GtMainGame: if (_player == null) // When deleted then find new player again { _player = GameObject.Find("Player"); } Camera.main.transform.position = Vector3.Lerp(Camera.main.transform.position, new Vector3(_player.transform.GetChild(0).position.x, Camera.main.transform.position.y, Camera.main.transform.position.z), Time.smoothDeltaTime); break; case GameTransition.GtMainGameDone: ShowMessage("Cugood: My beloved Cutie! Once again we are together!", Color.blue, 4.0f); AudioSource.PlayClipAtPoint(DialogClips[5], Camera.main.transform.position, 0.5f); GetComponent <AudioSource>().clip = AmbientClips[2]; GetComponent <AudioSource>().Play(); _gameTransition = GameTransition.GtCugoodFindsCutie; break; case GameTransition.GtCugoodFindsCutie: if (MessageEnded) { _gameTransition = GameTransition.GtCugoodFindsCutieDone; } break; case GameTransition.GtCugoodFindsCutieDone: ShowMessage("Cutier: Gugood I am not Cutie I am Cutier. Cutie is in another Cage.", Color.magenta, 6.0f); AudioSource.PlayClipAtPoint(DialogClips[6], Camera.main.transform.position, 0.5f); _gameTransition = GameTransition.GtCutierIntro; break; case GameTransition.GtCutierIntro: if (MessageEnded) { _gameTransition = GameTransition.GtCutierIntroDone; } break; case GameTransition.GtCutierIntroDone: ShowMessage("Cugood: Oh Sh... Ehm Oops!", Color.blue, 3.0f); AudioSource.PlayClipAtPoint(DialogClips[7], Camera.main.transform.position, 0.5f); _gameTransition = GameTransition.GtCugoodOops; break; case GameTransition.GtCugoodOops: if (MessageEnded) { _gameTransition = GameTransition.GtCugoodOopsDone; } break; case GameTransition.GtCugoodOopsDone: ShowMessage("Cutier: Find her and defeat Cubad once and for all !!! ", Color.magenta, 6.0f); AudioSource.PlayClipAtPoint(DialogClips[8], Camera.main.transform.position, 0.5f); _gameTransition = GameTransition.GtCutierFindHer; break; case GameTransition.GtCutierFindHer: if (MessageEnded) { _gameTransition = GameTransition.GtCutierFindHerDone; } break; case GameTransition.GtCutierFindHerDone: ShowMessage("Cugood: She will be fine... You know you are very cute also...", Color.blue, 6.0f); AudioSource.PlayClipAtPoint(DialogClips[9], Camera.main.transform.position, 0.5f); _particleManager.GetParticleSystem("Player").Play(); _gameTransition = GameTransition.GtCugoodCompliment; break; case GameTransition.GtCugoodCompliment: if (MessageEnded) { _gameTransition = GameTransition.GtCugoodComplimentDone; } break; case GameTransition.GtCugoodComplimentDone: ShowMessage("Cutier: Oh Cugood... ", Color.magenta, 4.0f); AudioSource.PlayClipAtPoint(DialogClips[10], Camera.main.transform.position, 0.5f); _particleManager.GetParticleSystem("PlayerFemale2").Play(); _gameTransition = GameTransition.GtCutierOh; break; case GameTransition.GtCutierOh: if (MessageEnded) { _gameTransition = GameTransition.GtCutierOhDone; } break; case GameTransition.GtCutierOhDone: _gameTransition = GameTransition.GtCameraUp; _playerBad.SetActive(true); _playerBad.GetComponent <BoxController>().ResetToPosition(new Vector3(_lastCameraCheckPoint.x, _lastCameraCheckPoint.y - 10, 0)); HideMessage(); break; case GameTransition.GtCameraUp: Camera.main.transform.position = Vector3.Lerp(Camera.main.transform.position, _lastCameraCheckPoint, 0.5f * Time.smoothDeltaTime); _playerBad.transform.GetChild(0).GetComponent <Rigidbody>().velocity = Vector3.up * 1.0f; if (Vector3.Distance(Camera.main.transform.position, _lastCameraCheckPoint) < 1f) { _gameTransition = GameTransition.GtCameraUpDone; } break; case GameTransition.GtCameraUpDone: ShowMessage("Cubad: The end ...", Color.black, 4.0f); AudioSource.PlayClipAtPoint(DialogClips[11], Camera.main.transform.position, 0.5f); _gameTransition = GameTransition.GtEnd; break; case GameTransition.GtEnd: _playerBad.transform.GetChild(0).GetComponent <Rigidbody>().velocity = Vector3.up * 1.0f; if (MessageEnded) { _gameTransition = GameTransition.GtEndDone; } break; case GameTransition.GtEndDone: if (MessageEnded) { Application.Quit(); } break; default: break; } if (_gameTransition != GameTransition.GtMainGame && Input.GetKeyDown(KeyCode.Space)) { SkipIntro(); } _playerFemale2.transform.position = _startPlayerFemale2Pos; _playerFemale2.transform.rotation = _startPlayerFemale2Rot; }
void StartGame() { if (! Global.GameSetting().valid) { Debug.LogWarning("GameSetting is not valid."); return; } var _map = Global.GameSetting().map; var _mode = Global.GameSetting().modeSelected; _mode.overrideMode = true; var _transition = new GameTransition() .Map(_map) .Mode(_mode); Global.Transition().RequestStartGame(_transition); }
void SetupGame() { m_GameTransition.Setup(); m_GameTransition = null; Global.Context().context = ContextType.GAME; }