private void CreateCharacter() { PlayerStateContainer container = PlayerStateContainer.Instance; container.TeamSelection = PlayerStateContainer.EXPLORER; container.ExplorerSelection = PlayerStateContainer.DOUBLE_JUMP_EXPLORER; explorer = PhotonNetwork.Instantiate(doubleJumpPrefab.name, new Vector3(2, 2), Quaternion.identity, 0).GetComponent <BaseExplorer>(); explorer.SendTalentsToNetwork(); Camera.main.transform.position = explorer.transform.position; }
public void Awake() { if (Instance == null) { DontDestroyOnLoad(gameObject); Instance = this; ResetInstance(); } else if (Instance != this) { Destroy(gameObject); } }
public void Awake() { Application.targetFrameRate = 60; QualitySettings.vSyncCount = 0; exitButton.gameObject.SetActive( Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.LinuxPlayer); PhotonNetwork.logLevel = logLevel; PhotonNetwork.autoJoinLobby = false; PhotonNetwork.automaticallySyncScene = true; PhotonNetwork.autoCleanUpPlayerObjects = true; PhotonNetwork.sendRate = 30; PhotonNetwork.sendRateOnSerialize = 30; OpenStartPanel(); versionText.text = "Game Version: " + Constants.GAME_VERSION; PlayerStateContainer.ResetInstance(); lobbyMusicBehavior = FindObjectOfType <LobbyMusicBehavior>(); lobbyMusicBehavior.StartMusic(); }
public void InstantiateCharacter() { PlayerStateContainer playerContainer = PlayerStateContainer.Instance; if (playerContainer.TeamSelection == PlayerStateContainer.EXPLORER) { float spawnLocationX = (UnityEngine.Random.Range(1, levelChunks.GetLength(0) - 1) * 16) + 2; float spawnLocationY = (UnityEngine.Random.Range(levelChunks.GetLength(1) / 2, levelChunks.GetLength(1)) * 16) + 2; Vector3 spawnLocation = new Vector3(spawnLocationX, spawnLocationY); switch (playerContainer.ExplorerSelection) { case PlayerStateContainer.DOUBLE_JUMP_EXPLORER: Explorer = PhotonNetwork.Instantiate(doubleJumpPrefab.name, spawnLocation, Quaternion.identity, 0) .GetComponent <BaseExplorer>(); break; case PlayerStateContainer.JETPACK_EXPLORER: Explorer = PhotonNetwork.Instantiate(jetpackPrefab.name, spawnLocation, Quaternion.identity, 0) .GetComponent <BaseExplorer>(); break; case PlayerStateContainer.DASH_EXPLORER: Explorer = PhotonNetwork.Instantiate(dashPrefab.name, spawnLocation, Quaternion.identity, 0) .GetComponent <BaseExplorer>(); break; } if (Explorer != null) { Explorer.SendTalentsToNetwork(); Explorer.SendNameToNetwork(); Camera.main.transform.position = Explorer.transform.position; } ChangeMaskColor(0f); } else if (playerContainer.TeamSelection == PlayerStateContainer.NIGHTMARE) { float spawnLocationX = (UnityEngine.Random.Range(1, levelChunks.GetLength(0) - 1) * 16) + 2; float spawnLocationY = (UnityEngine.Random.Range(0, levelChunks.GetLength(1) / 2) * 16) + 2; Vector3 spawnLocation = new Vector3(spawnLocationX, spawnLocationY); switch (playerContainer.NightmareSelection) { case PlayerStateContainer.GHAST: Nightmare = PhotonNetwork.Instantiate(ghastPrefab.name, spawnLocation, Quaternion.identity, 0) .GetComponent <BaseNightmare>(); break; case PlayerStateContainer.CRYO: Nightmare = PhotonNetwork.Instantiate(cryoPrefab.name, spawnLocation, Quaternion.identity, 0) .GetComponent <BaseNightmare>(); break; case PlayerStateContainer.GOBLIN: Nightmare = PhotonNetwork.Instantiate(goblinPrefab.name, spawnLocation, Quaternion.identity, 0) .GetComponent <BaseNightmare>(); break; } if (Nightmare != null) { Nightmare.SendTalentsToNetwork(); Nightmare.SendNameToNetwork(); Camera.main.transform.position = Nightmare.gameObject.transform.position; } ChangeMaskColor(0f); } else { ChangeMaskColor(0.5f); } }