public override void SetOrder(ActorOrder newOrder) { base.SetOrder(newOrder); // reset order states. m_ReachedPatrolPoint = false; m_ReportStage = 0; }
void OnBeginMove(object sender, EventArgs arg) { BeginMoveEvtArg e = arg as BeginMoveEvtArg; if (e.ac == this && state != ActorState.DEAD) { transform.LookAt(new Vector3(e.position.x, transform.position.y, e.position.z)); order = ActorOrder.MOVETO_ORDER; targetUnit = null; agent.SetDestination(e.position); SetState(new MovingActorState(this)); } }
protected ActorAction ExecuteOrder(RogueGame game, ActorOrder order, List <Percept> percepts, ExplorationData exploration) { // cancel if leader is dead! if (m_Actor.Leader == null || m_Actor.Leader.IsDead) { return(null); } // execute task. switch (order.Task) { case ActorTasks.BARRICADE_ONE: return(ExecuteBarricading(game, order.Location, false)); case ActorTasks.BARRICADE_MAX: return(ExecuteBarricading(game, order.Location, true)); case ActorTasks.BUILD_SMALL_FORTIFICATION: return(ExecuteBuildFortification(game, order.Location, false)); case ActorTasks.BUILD_LARGE_FORTIFICATION: return(ExecuteBuildFortification(game, order.Location, true)); case ActorTasks.DROP_ALL_ITEMS: return(ExecuteDropAllItems(game)); case ActorTasks.GUARD: return(ExecuteGuard(game, order.Location, percepts)); case ActorTasks.PATROL: return(ExecutePatrol(game, order.Location, percepts, exploration)); case ActorTasks.REPORT_EVENTS: return(ExecuteReport(game, percepts)); case ActorTasks.SLEEP_NOW: return(ExecuteSleepNow(game, percepts)); case ActorTasks.FOLLOW_TOGGLE: return(ExecuteToggleFollow(game)); case ActorTasks.WHERE_ARE_YOU: return(ExecuteReportPosition(game)); default: throw new NotImplementedException("order task not handled"); } }