Example #1
0
    // EntityAction should require a constructor with at least the id of the entity
    // this constructor should set
    // this.entityActionEnum
    // this.priorityList
    // this.id
    // this.direction
    // this.entityBrain
    // this.entityBase

    protected EntityAction(int aId, EntityActionEnum aEntityActionEnum, Vector2Int?aDirection = null, List <EntityActionEnum> aPriorityList = null)
    {
        this.entityActionEnum = aEntityActionEnum;
        this.priorityList     = aPriorityList ?? new List <EntityActionEnum>();
        this.id          = aId;
        this.direction   = aDirection ?? Vector2Int.zero;
        this.entityBase  = GM.boardManager.GetEntityBaseById(this.id);
        this.entityBrain = this.entityBase.entityBrain;
        switch (this.entityActionEnum)
        {
        case EntityActionEnum.MOVE:
            this.canBeInterrupted = true;
            break;

        case EntityActionEnum.FALL:
            this.canBeInterrupted = true;
            break;

        case EntityActionEnum.DIE:
            this.canBeInterrupted = false;
            break;

        case EntityActionEnum.PUSH:
            this.canBeInterrupted = true;
            break;

        case EntityActionEnum.TURN:
            this.canBeInterrupted = true;
            break;

        case EntityActionEnum.WAIT:
            this.canBeInterrupted = true;
            break;

        case EntityActionEnum.EXIT:
            this.canBeInterrupted = false;
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }
    }
Example #2
0
 public static EntityState SetAction(EntityState aEntityState, EntityActionEnum aActionEnum)
 {
     aEntityState.currentAction = aActionEnum;
     return(aEntityState);
 }