Esempio n. 1
0
        public GameObject SpawnPlayer(int spawnPointId)
        {
            if (currentPlayer != null)
            {
                return(currentPlayer.gameObject);
            }

            GameObject point = sceneController.FindSpawnPoint(spawnPointId);

            if (point == null)
            {
                throw new CouldntSpawnPlayer();
            }

            GameObject currentPlayerGO = Instantiate(playerPrefab, point.transform.position, point.transform.rotation);

            currentPlayer = currentPlayerGO.GetComponent <PlayerActor>();

            equipmentManager.targetMesh = currentPlayer.gameObject;
            onPlayerInited += () => equipmentManager.EquipDefault();
            return(currentPlayer.gameObject);
        }