예제 #1
0
    public void GoalTouched(AgentCars.Team scoredTeam)
    {
        foreach (CarState ps in playerStates)
        {
            if (ps.agentScript.team == scoredTeam)
            {
                RewardOrPunishPlayer(ps, academy.strikerReward, academy.goalieReward);
            }
            else
            {
                RewardOrPunishPlayer(ps, academy.strikerPunish, academy.goaliePunish);
            }
            if (academy.randomizePlayersTeamForTraining)
            {
                ps.agentScript.ChooseRandomTeam();
            }

            if (scoredTeam == AgentCars.Team.Red)
            {
                StartCoroutine(GoalScoredSwapGroundMaterial(academy.redMaterial, 1));
            }
            else
            {
                StartCoroutine(GoalScoredSwapGroundMaterial(academy.blueMaterial, 1));
            }
            if (goalTextUI)
            {
                StartCoroutine(ShowGoalUI());
            }
        }
    }
예제 #2
0
    public Vector3 GetRandomSpawnPos(AgentCars.AgentRole role, AgentCars.Team team)
    {
        float xOffset = 0f;

        if (role == AgentCars.AgentRole.Goalie)
        {
            xOffset = 13f;
        }
        if (role == AgentCars.AgentRole.Striker)
        {
            xOffset = 7f;
        }
        if (team == AgentCars.Team.Blue)
        {
            xOffset = xOffset * -1f;
        }
        var randomSpawnPos = ground.transform.position +
                             new Vector3(xOffset, 0f, 0f)
                             + (Random.insideUnitSphere * 2);

        randomSpawnPos.y = ground.transform.position.y + 2;
        return(randomSpawnPos);
    }