예제 #1
0
        public void EnterRoom(ExitPosition exitPosition, int roomId)
        {
            gameState = GameState.None;
            enemies.Clear();

            int wealth = _player.wealth;

            Destroy(_player.gameObject);

            if (_maze.ExitRoomId == roomId)
            {
                winText.text = $"You found the exit and acquired {wealth} Wealth!";
                StartCoroutine(EndGame());
            }
            else
            {
                LoadRoom(roomId);

                _player = Instantiate(playerPrefab) as Player;

                _player.name   = "Player";
                _player.wealth = wealth;

                switch (exitPosition)
                {
                case ExitPosition.North:
                    _player.SetLocation(0.5f, 4.5f);
                    break;

                case ExitPosition.East:
                    _player.SetLocation(8.5f, 0.5f);
                    break;

                case ExitPosition.South:
                    _player.SetLocation(0.5f, -3.5f);
                    break;

                case ExitPosition.West:
                    _player.SetLocation(-7.5f, 0.5f);
                    break;

                default:
                    break;
                }

                EnablePlayerInput();
            }
        }
예제 #2
0
        public void SpawnPlayer()
        {
            _player.SetLocation(.5f, .5f);

            LoadRoom(0);
        }