Example #1
0
    private void SpawnShipOfType(ShipController.ShipType shipType)
    {
        GameObject aiPlayer = Instantiate(aiShipPrefab);

        teamController.RegisterUnit(aiPlayer);
        ShipController controller = aiPlayer.GetComponent <ShipController>();

        controller.SetShipType(shipType);
        controller.SetReadyForGame(true);
        Vector3 spawnPosition = GameLevelSceneManager.instance.GetSpawnPosition(team);

        aiPlayer.transform.position = spawnPosition;
        NetworkServer.Spawn(aiPlayer);
        teamCount++;
        switch (shipType)
        {
        case ShipController.ShipType.FIGHTER:
            currentFigtherPerSquad++;
            break;

        case ShipController.ShipType.FRIGATE:
            currentFrigatePerSquad++;
            break;

        case ShipController.ShipType.DESTROYER:
            currentDestroyerPerSquad++;
            break;

        default:
            throw new Exception();
        }
    }
Example #2
0
    public void ReportKill(GameObject target)
    {
        if (side == TeamSide.green)
        {
            ScoreKeeper.kills++;
        }


        ShipController.ShipType targetType = target.GetComponent <ShipController>().shipType;

        switch (targetType)
        {
        case ShipController.ShipType.capital:
            capitalKills++;
            break;

        case ShipController.ShipType.fighter:
            fighterKills++;
            break;

        case ShipController.ShipType.bomber:
            fighterKills++;
            break;

        case ShipController.ShipType.scout:
            fighterKills++;
            break;

        case ShipController.ShipType.support:
            fighterKills++;
            break;
        }
    }
Example #3
0
 /// <summary>
 /// This method will be called when the user selects a ship type to use. The ShipeType is passed as a parameter.
 /// </summary>
 public static void OnShipConfigMenuShipSelected(ShipController.ShipType type)
 {
     Assert.IsNotNull(ShipConfigMenuShipSelectedEvent);
     if (ShipConfigMenuShipSelectedEvent != null)
     {
         ShipConfigMenuShipSelectedEvent(type);
     }
 }
Example #4
0
 /// <summary>
 /// This method will be called when the user selected a ship from the UI. This method will set the variables
 /// and spawn the player in the correct position.
 /// </summary>
 public void OnShipConfigMenuShipSelected(ShipController.ShipType type)
 {
     GameLevelEventManager.ShipConfigMenuShipSelectedEvent -= OnShipConfigMenuShipSelected;
     CmdDoSetShipType(type);
     DismissShipConfigMenu();
     transform.position = sceneManager.GetSpawnPosition(teamTag);
     CmdDoSetReadyForGame(true);
     isPause = false;
 }