Beispiel #1
0
    public Enemy FindAction(Enemy enemy, string action)
    {
        //finds the action or trait from the string provided

        switch (action)
        {
        //for the actions
        case "hop":
            enemy.AddAction(action);
            break;

        case "shock":
            enemy.AddAction(action);
            break;

        case "hungry":
            enemy.AddAction(action);
            break;

        //for the Traits
        case "explosive":
            enemy.AddTrait(Enemy.EXPLOSIVE);
            break;

        default:
            Debug.Log(TAG + "Warning. Did not understand the data");
            break;
        }
        return(enemy);
    }
Beispiel #2
0
    public override void Act(Enemy source, ActionContext context)
    {
        foreach (Action action in actions)
        {
            if (notFirstLoop)
            {
                action.time += period;
            }
            source.AddAction(action);
        }

        Loop nextIteration = new Loop(time + period, period, actions);

        source.AddAction(nextIteration);
    }