예제 #1
0
    public void GenericPassAction(GameObject actionUser)
    {
        List <GameObject> fielders = PlayerUtils.GetFieldersOnField()
                                     .Where(fielder => !fielder.Equals(actionUser))
                                     .OrderBy(fielder => Vector3.Distance(actionUser.transform.position, fielder.transform.position))
                                     .ToList();

        Action <GameObject, GameObject> finalActionsToPerform = PassBallAction;

        //Add an additionnal action for the pass. => go back to initial placement for the catcher.
        if (PlayerUtils.HasCatcherPosition(actionUser))
        {
            CatcherBehaviour catcherBehaviour = PlayerUtils.FetchCatcherBehaviourScript(actionUser);
            finalActionsToPerform += catcherBehaviour.ReturnToInitialPosition;
        }

        TargetSelectionManager.EnableSelection(fielders.First().transform.position, fielders, finalActionsToPerform, actionUser);
    }