Exemplo n.º 1
0
 // ================================== MONOBEHAVIOUR ====================================
 private void Start()
 {
     // Get spawned player, if there is no spawner set attached gameobject for HUD setup
     if (_spawner == null)
     {
         _robot = _playerCharacter;                   // Player character reference
     }
     else
     {
         _robot           = _spawner.GetSpawned();    // Spawner tracker reference
         _playerCharacter = null;
     }
 }
Exemplo n.º 2
0
    // ========================================== ROBOT =============================================
    public void UpdateRobot()
    {
        if (_gameSettings.Robots.Count == 0)
        {
            return;                                                                          // Check for robot prefabs
        }
        if (_playerSpawner == null)
        {
            return;
        }
        // Check for default components depending on robot type
        GameObject leftComponent = _leftComponentIndex == 0 ?  _gameSettings.Robots[_robotIndex].leftComponent.prefab
                                                            :   _gameSettings.Components[_leftComponentIndex - 1].prefab;
        GameObject rightComponent = _rightComponentIndex == 0 ? _gameSettings.Robots[_robotIndex].rightComponent.prefab
                                                            :   _gameSettings.Components[_rightComponentIndex - 1].prefab;

        _playerSpawner.Spawn(_gameSettings.Robots[_robotIndex].prefab,
                             leftComponent,
                             rightComponent);
        _playerSpawner.FreezeSpawned();
        _playerSpawner.GetSpawned().GetComponent <HitPoints>().Invincible = true;
    }