コード例 #1
0
ファイル: Player.cs プロジェクト: MarkosUA/Archer
 private void Construct(Joystick joystick, CharactersData charactersData, IBulletSystem bulletSystem,
                        IPrefabsCreater prefabsCreater, GameSettings gameSettings, IEndGame endGame, IPlayerHealth playerHealth)
 {
     _joystick       = joystick;
     _navMeshAgent   = GetComponent <NavMeshAgent>();
     _playerHP       = charactersData.PlayerData.CharacterHp;
     _playerSpeed    = charactersData.PlayerData.CharacterSpeed;
     _bulletSystem   = bulletSystem;
     _prefabsCreater = prefabsCreater;
     _gameSettings   = gameSettings;
     _endGame        = endGame;
     _playerHealth   = playerHealth;
     _playerHealth.ChangeHealth(_playerHP);
     _canShoot = true;
 }
コード例 #2
0
    private void OnTriggerEnter(Collider other)
    {
        ITriggerPlayer trigger    = other.GetComponent <ITriggerPlayer>();
        IEndGame       triggerEnd = other.GetComponent <IEndGame>();

        if (trigger != null)
        {
            trigger.OnTriggerCarDetail(_nextPart, gameObject);
            trigger.OnTriggerObstacle(_previousPart, gameObject, _detail);
        }

        if (triggerEnd != null)
        {
            triggerEnd.OnTriggerEndGame(gameObject);
            triggerEnd.OnTriggerLoseObstacle(gameObject);
        }
    }
コード例 #3
0
        public static GameState MakeInitialGameState(List <Player> players, TurnCount totalRounds, GridSize gridSize, ICollisions iCollisions, IEndGame iEndGame)
        {
            var gameState = new GameState()
            {
                Round       = 1,
                TotalRounds = totalRounds,
                GameOver    = false,
                GridSize    = gridSize,
                Players     = new List <Player>(),
                Collisions  = iCollisions,
                EndGame     = iEndGame
            };

            foreach (var player in players)
            {
                int x = RandomWrapper.RandomNumber(0, gameState.GridSize.Cols);
                int y = RandomWrapper.RandomNumber(0, gameState.GridSize.Rows);
                player.Destroyed = false;
                player.Position  = new Position(x, y);
                gameState.Players.Add(player);
            }
            return(gameState);
        }
コード例 #4
0
 public void SetEnd(IEndGame end)
 {
     this.end = end;
 }
コード例 #5
0
ファイル: EnemyRemover.cs プロジェクト: MarkosUA/Archer
 public EnemyRemover(IPrefabsCreater prefabsCreater, IEndGame endGame, GameSettings gameSettings)
 {
     _prefabsCreater = prefabsCreater;
     _gameSettings   = gameSettings;
     _endGame        = endGame;
 }