Exemplo n.º 1
0
    private void RandomizeDecision(HockeyPlayer h, HockeyPlayer other)
    {
        int choice = Random.Range(0, 10);

        switch (choice)
        {
        case 0:
            //strike
            Vector3 goalPos = new Vector3(
                isPlayerTeam ? 44f : -44f,
                0f,
                Random.Range(-5.5f, 5.5f));
            h.PassingPuck(goalPos, Ultilities.CalculateShootingPower(h.transform.position, goalPos) + 1);
            break;

        case 1:
        case 2:
        case 3:
            //pass ball
            h.PassingPuck(other.transform.position + new Vector3(Random.Range(-1f, 1f), 0f, Random.Range(-2f, 2f)),
                          Ultilities.CalculateShootingPower(h.transform.position, other.transform.position));
            break;

        default:
            Vector3 posToMove = new Vector3(
                isPlayerTeam ? 38f : -38f,
                0f,
                Random.Range(-20f, 20f));
            h.MoveToPosition(posToMove);
            //move
            break;
        }
    }