Exemple #1
0
    /// <summary>
    /// Set the target gameObject as the capital ship of the specified team.
    /// </summary>
    /// <param name="tag"></param>
    /// <param name="target"></param>
    public void RegisterCapitalShip(TEAMTAG tag, GameObject target)
    {
        switch (tag)
        {
        case TEAMTAG.RED:
            capitalShipRed = target;
            break;

        case TEAMTAG.BLUE:
            capitalShipBlue = target;
            break;

        default:
            throw new UnityException();
        }
    }
 public GameObject GetCapitalShip(TEAMTAG team)
 {
     GameObject capitalShip;
     switch (team)
     {
         case TEAMTAG.RED:
             capitalShip = capitalShipRed;
             break;
         case TEAMTAG.BLUE:
             capitalShip = capitalShipBlue;
             break;
         default:
             throw new UnityException();
     }
     return capitalShip;
 }
    /// <summary>
    /// Returns a Vector3 that should be used as the spawn point for the next ship. The spawn location
    /// will be based on the location of the game objects registered as capital ship for each team;
    /// </summary>
    /// <param name="tag"></param>
    /// <returns></returns>
    public Vector3 GetSpawnPosition(TEAMTAG tag)
    {
        GameObject capitalShip;
        switch (tag)
        {
            case TEAMTAG.RED:
                capitalShip = capitalShipRed;
                break;
            case TEAMTAG.BLUE:
                capitalShip = capitalShipBlue;
                break;
            default:
                throw new UnityException();
        }

        // This is just a hack to get spawn points in a spherical shape around the capital ship
        return (capitalShip.transform.position) + (Vector3.up * 100);
    }
Exemple #4
0
    public GameObject GetCapitalShip(TEAMTAG team)
    {
        GameObject capitalShip;

        switch (team)
        {
        case TEAMTAG.RED:
            capitalShip = capitalShipRed;
            break;

        case TEAMTAG.BLUE:
            capitalShip = capitalShipBlue;
            break;

        default:
            throw new UnityException();
        }
        return(capitalShip);
    }
Exemple #5
0
    /// <summary>
    /// Returns a Vector3 that should be used as the spawn point for the next ship. The spawn location
    /// will be based on the location of the game objects registered as capital ship for each team;
    /// </summary>
    /// <param name="tag"></param>
    /// <returns></returns>
    public Vector3 GetSpawnPosition(TEAMTAG tag)
    {
        GameObject capitalShip;

        switch (tag)
        {
        case TEAMTAG.RED:
            capitalShip = capitalShipRed;
            break;

        case TEAMTAG.BLUE:
            capitalShip = capitalShipBlue;
            break;

        default:
            throw new UnityException();
        }

        // This is just a hack to get spawn points in a spherical shape around the capital ship
        return((capitalShip.transform.position) + (Vector3.up * 100));
    }
Exemple #6
0
    public TeamController GetTeamController(TEAMTAG tag)
    {
        GameObject capitalShip;

        switch (tag)
        {
        case TEAMTAG.RED:
            capitalShip = capitalShipRed;
            break;

        case TEAMTAG.BLUE:
            capitalShip = capitalShipBlue;
            break;

        default:
            throw new UnityException();
        }

        TeamController controller = capitalShip.GetComponent <TeamController>();

        Assert.IsNotNull(controller);
        return(controller);
    }
Exemple #7
0
    public void OnCapitalShipDestroyed(TEAMTAG tag)
    {
        GameObject winner;
        GameObject loser;

        switch (tag)
        {
        case TEAMTAG.RED:
            loser  = capitalShipRed;
            winner = capitalShipBlue;
            break;

        case TEAMTAG.BLUE:
            loser  = capitalShipBlue;
            winner = capitalShipRed;
            break;

        default:
            throw new UnityException();
        }
        winner.GetComponent <TeamController>().OnGameEnded(true);
        loser.GetComponent <TeamController>().OnGameEnded(false);
    }
    public TeamController GetTeamController(TEAMTAG tag)
    {
        GameObject capitalShip;
        switch (tag)
        {
            case TEAMTAG.RED:
                capitalShip = capitalShipRed;
                break;
            case TEAMTAG.BLUE:
                capitalShip = capitalShipBlue;
                break;
            default:
                throw new UnityException();
        }

        TeamController controller = capitalShip.GetComponent<TeamController>();
        Assert.IsNotNull(controller);
        return controller;
    }
 /// <summary>
 /// Set the target gameObject as the capital ship of the specified team.
 /// </summary>
 /// <param name="tag"></param>
 /// <param name="target"></param>
 public void RegisterCapitalShip(TEAMTAG tag, GameObject target)
 {
     switch (tag)
     {
         case TEAMTAG.RED:
             capitalShipRed = target;
             break;
         case TEAMTAG.BLUE:
             capitalShipBlue = target;
             break;
         default:
             throw new UnityException();
     }
 }
 public void OnCapitalShipDestroyed(TEAMTAG tag)
 {
     GameObject winner;
     GameObject loser;
     switch (tag)
     {
         case TEAMTAG.RED:
             loser = capitalShipRed;
             winner = capitalShipBlue;
             break;
         case TEAMTAG.BLUE:
             loser = capitalShipBlue;
             winner = capitalShipRed;
             break;
         default:
             throw new UnityException();
     }
     winner.GetComponent<TeamController>().OnGameEnded(true);
     loser.GetComponent<TeamController>().OnGameEnded(false);
 }