Beispiel #1
0
    public ContestantAction(string name, ContestantActionsEnum actionType, Action <float> action, float time, Contestant con, int range, float timeCost, bool friendlyTeam, Func <T, bool> additionalChecks)
    {
        this.name       = name;
        this.actionType = actionType;
        this.action     = action;
        this.time       = time;

        this.caUI = new ContestantActionUI(ContestantActionsFactory.GetSpriteFromType(actionType));

        this.controlMode = new TargetSelectorMode <T> (this, con, range, timeCost, friendlyTeam, additionalChecks);
    }
    public void ThrowToTarget(float time)
    {
        TargetSelectorMode <ICatcher> tsm = ((TargetSelectorMode <ICatcher>)currentControlMode);

        ICatcher        currentTarget = tsm.CurrentTarget;
        List <ICatcher> targets       = tsm.Targets;

        if (currentTarget != null)
        {
            ICatcher catcher = (ICatcher)currentTarget;

            if (targets.Contains(catcher))
            {
                selected.Ball.RegisterOnFinishedLaunch(() => {
                    ControlModeType = ControlModeEnum.Move;
                });

                selected.Ball.ThrowToCatcher(selected, catcher, tsm.TargetProbabilities[catcher], time);
            }
        }
    }
 /// <summary>
 ///     Sets the <see cref="TargetSelectorMode" /> of the target selector.
 /// </summary>
 /// <param name="mode">Mode</param>
 public static void SetPriorityMode(TargetSelectorMode mode)
 {
     //TODO: Replace this with menu code.
     _mode = mode;
 }