/// <summary> /// Given an entity, this function will cause the entity to perform whatever action is currently on the entity's /// action queue. /// </summary> /// <param name="entity"></param> public void update(Entity entity, EntityLocController locController) { Queue<ActionCommand> actionQueue = entity.getActionQueue(); if(actionQueue.Count > 0) { ActionCommand command = actionQueue.Peek(); if (command.work()) { actionQueue.Dequeue(); } if (entity.entityType == Entity.EntityType.Unit) { locController.updateUnitLocation((Unit)entity); } } }
/// <summary> /// Given an entity, this function will cause the entity to perform whatever action is currently on the entity's /// action queue. /// </summary> /// <param name="entity"></param> public void update(Entity entity, EntityLocController locController) { Queue <ActionCommand> actionQueue = entity.getActionQueue(); if (actionQueue.Count > 0) { ActionCommand command = actionQueue.Peek(); if (command.work()) { actionQueue.Dequeue(); } if (entity.entityType == Entity.EntityType.Unit) { locController.updateUnitLocation((Unit)entity); } } }
/// <summary> /// Given an entity, this function will cause the entity to perform whatever action is currently on the entity's /// action queue. /// </summary> /// <param name="entity"></param> public void update(Entity entity, EntityLocController locController) { List <ActionCommand> actionQueue = entity.getActionQueue(); if (actionQueue.Count > 0) { ActionCommand command = actionQueue[0]; //Console.WriteLine(command.actionType); if (command.work()) { // Action is done, remove and set Entity's state to idle. actionQueue.RemoveAt(0); entity.getState().setPrimaryState(State.PrimaryState.Idle); } if (entity.entityType == Entity.EntityType.Unit) { // Unit may have moved, update it's location in the GameWorld. locController.updateUnitLocation((Unit)entity); } } }
/// <summary> /// Given an entity, this function will cause the entity to perform whatever action is currently on the entity's /// action queue. /// </summary> /// <param name="entity"></param> public void update(Entity entity, EntityLocController locController) { List<ActionCommand> actionQueue = entity.getActionQueue(); if(actionQueue.Count > 0) { ActionCommand command = actionQueue[0]; if (command.work()) { // Action is done, remove and set Entity's state to idle. actionQueue.RemoveAt(0); entity.getState().setPrimaryState(State.PrimaryState.Idle); } if (entity.entityType == Entity.EntityType.Unit) { // Unit may have moved, update it's location in the GameWorld. locController.updateUnitLocation((Unit)entity); } } }