public Player_Spawn player_spawn; //Setting the palyer_Spawn //Called once per frame private void Update() { //Getting the player_spawn if (player_spawn == null) { player_spawn = FindObjectOfType <Player_Spawn>(); } }
void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(this.gameObject); } else { Destroy(gameObject); } }
void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(this); } else { Destroy(gameObject); } GameManager.Instance.playerPrefab.transform.position = new Vector3(GameManager.Instance.posx, GameManager.Instance.posy, 0); }
void CreateChracter(int job, int userNumber, Packet msg) { for (int i = 0; i < userNumber; i++) { int user_position = msg.PopInt32(); string msgUserLoginID = msg.PopString(); GameObject objSpawner = GameObject.Find("Player_Spawn"); Player_Spawn componentSpawner = objSpawner.GetComponent <Player_Spawn>(); //캐릭터 생성 GameObject myPlayer = componentSpawner.CreateMyPlayer(job, user_position); //myPlayer.GetComponent<Player5>().headCamera.SetActive(false); //디폴트를 비활성화 시킴 NetworkObj objNetInfo = myPlayer.GetComponent <NetworkObj>(); objNetInfo.remoteId = msgUserLoginID; lock (csNetworkObj) { networkObj.Add(objNetInfo.remoteId, myPlayer); print("추가됨"); } if (userID == objNetInfo.remoteId) { myPlayer.GetComponent <Player5>().isPlayer = true; myPlayer.GetComponent <Player5>().main_camera.gameObject.SetActive(true); GameObject winlose = GameObject.Find("WinLose"); winlose winlose_component = winlose.GetComponent <winlose>(); winlose_component.user_job = myPlayer.GetComponent <Player5>().player_job; myPlayer.GetComponent <Player5>().user_name.text = userID; if (job == 1) { myPlayer.GetComponent <Player5>().user_job.text = "경찰"; } else if (job == 2) { myPlayer.GetComponent <Player5>().user_job.text = "도둑"; } } } }