Beispiel #1
0
    public void Setup()
    {
        _networkPlayerInputs = new List <NetworkPlayerInput>();

        _energySpawner = new NetworkEnergySpawner();
        _energySpawner.SetEnergyLoader(new NetworkTestEnergyLoader());
        (_energySpawner as NetworkEnergySpawner).energyPrefab = energyPrefab;

        _spawnPointSpawner = new NetworkSpawnPointSpawner();
        _spawnPointSpawner.SetSpawnPointLoader(new NetworkTestSpawnPointLoader());
        (_spawnPointSpawner as NetworkSpawnPointSpawner).spawnPointPrefab = spawnPointPrefab;

        // Create NetworkOutput
        _networkPlayerOutputController = gameObject.AddComponent <NetworkPlayerOutputController>();

        // Create Game Manager
        _gameManager         = gameObject.AddComponent <GameManager>();
        _gameManager.enabled = false;

        // Create RoundManager
        _roundManager = new RoundManager(3);

        _gameManager.SetRoundManager(_roundManager);

        _currentPlayerId = 0;
    }
Beispiel #2
0
    // Use this for initialization
    void Awake()
    {
        _players = new List <GameObject>();

        for (int i = 0; i < 2; i++)
        {
            _players.Add(Instantiate(_playerPrefab));
        }

        _players[0].transform.position = new Vector3(0.0f, 3.0f, 0.0f);
        _players[1].transform.position = new Vector3(0.0f, -3.0f, 0.0f);

        PlayerView[] playerViews = { _players[0].GetComponent <PlayerView>(), _players[1].GetComponent <PlayerView>() };

        gameObject.AddComponent <PlayerViewOutputController>().SetPlayerViews(playerViews);

        _energySpawner = new SinglePlayerEnergySpawner();
        _energySpawner.SetEnergyLoader(new FakeEnergyLoader());
        (_energySpawner as SinglePlayerEnergySpawner).energyPrefab = _energyPrefab;

        _energySpawner.LoadEnergies();
        _gameManager = gameObject.AddComponent <GameManager>();

        playerViews[0].InitializePlayerView(_gameManager, _energySpawner);
        playerViews[1].InitializePlayerView(_gameManager, _energySpawner);
    }
Beispiel #3
0
    public void Reset()
    {
        _currentPlayerId = 0;

        _networkPlayerInputs.Clear();

        _spawnPointSpawner = null;
        _energySpawner     = null;

        Destroy(_gameManager);
        Destroy(_networkPlayerOutputController);
    }
Beispiel #4
0
 public void Teardown()
 {
     _energyManager = null;
 }
Beispiel #5
0
 public void Setup()
 {
     _energyManager = new MockEnergySpawner();
     _energyManager.SetEnergyLoader(new MockEnergyLoader());
 }
Beispiel #6
0
 public void InitializePlayerView(GameManager gameController, BaseEnergySpawner energySpawner)
 {
     _gameManager   = gameController;
     _energySpawner = energySpawner;
 }
Beispiel #7
0
 public void SetEnergySpawner(BaseEnergySpawner energySpawner)
 {
     _energySpawner = energySpawner;
 }