Ejemplo n.º 1
0
    public void SetUpActions()
    {
        actions.Clear();

        for (int i = 0; i < noOfActions; i++)
        {
            ActionTypes actionType = (ActionTypes)Random.Range(0, Action.noOfActionTypes);
            Action      action     = null;

            switch (actionType)
            {
            case ActionTypes.DrinkWater:
                action = new DrinkWater();
                break;

            case ActionTypes.SitDown:
                action = new SitDown();
                break;

            case ActionTypes.Exit:
                action = new SitDown();
                break;

            case ActionTypes.UseCashier:
                action = new UseCashier();
                break;

            case ActionTypes.StartAttack:
                action = new SitDown();
                break;

            default:
                break;
            }

            action.SetActionTaker(this);
            actions.Add(action);
        }

        Action exitAction = new ExitAction();

        exitAction.SetActionTaker(this);
        actions.Add(exitAction);

        currActionIndex = 0;
    }
Ejemplo n.º 2
0
    public void SetIsAttacker()
    {
        isAttacker = true;
        int lastNormalAction = (int)(actions.Count / 3.0f);
        int attackAt         = Random.Range(0, lastNormalAction);

        Action attackAction = new StartAttack();

        attackAction.SetActionTaker(this);

        Action exitAction = new ExitAction();

        exitAction.SetActionTaker(this);

        actions.Insert(lastNormalAction + attackAt, attackAction);
        actions.Insert(lastNormalAction + attackAt + 1, exitAction);
    }