Exemple #1
0
    public static ContestantAction <T> CreateAction <T>(string name, ContestantActionsEnum actionType, float time, Contestant con, int range, float timeCost, bool friendlyTeam, Func <T, bool> additionalChecks = null) where T : IOccupant
    {
        Action <float> action = (t) => { };

        switch (actionType)
        {
        case ContestantActionsEnum.Throw:
            action = UserControlManager.Instance.ThrowToTarget;

            break;

        //i dont want the usercontrolmanager to have to know individual method
        //also, the usercontrolmanager gets the current control mode form storage,
        //but the controlmode is the one calling the action, so why not just
        //pass the mode forward?

        case ContestantActionsEnum.Swipe:
            action = UserControlManager.Instance.SwipeBall;
            break;

        case ContestantActionsEnum.Shoot:
            action = (t) => {
                Debug.Log("Phew");
            };
            break;
        }

        return(new ContestantAction <T> (name, actionType, action, time, con, range, timeCost, friendlyTeam, additionalChecks));
    }
Exemple #2
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);
    }
Exemple #3
0
 public static Sprite GetSpriteFromType(ContestantActionsEnum type)
 {
     return(ActionUIManager.Instance.actionButtonSprites[(int)type]);
 }