//////////////// ORDERS ///////////////////////// public bool IsOrderAddPossible(AgentOrder.E_OrderType orderType) { // 添加的一个判断,如果是停止动作,就可以直接打断 //if (orderType == AgentOrder.E_OrderType.E_STOPMOVE) //{ // return true; //} // 获取到记录的order状态 AgentOrder.E_OrderType currentOrder = Owner.WorldState.GetWSProperty(E_PropKey.E_ORDER).GetOrder(); // 当前状态不是闪避,攻击,和使用道具,返回真 // 当前状态是闪避,记录的状态不是闪避和使用道具,返回真 if (orderType == AgentOrder.E_OrderType.E_DODGE && currentOrder != AgentOrder.E_OrderType.E_DODGE && currentOrder != AgentOrder.E_OrderType.E_USE) { return(true); } else if (currentOrder != AgentOrder.E_OrderType.E_ATTACK && currentOrder != AgentOrder.E_OrderType.E_DODGE && currentOrder != AgentOrder.E_OrderType.E_USE) { return(true); } else { return(false); } }
public bool CouldAddnewOrder() { AgentOrder.E_OrderType order = Owner.WorldState.GetWSProperty(E_PropKey.E_ORDER).GetOrder(); if (order == AgentOrder.E_OrderType.E_DODGE || order == AgentOrder.E_OrderType.E_ATTACK || order == AgentOrder.E_OrderType.E_USE) { return(false); } AgentAction action; for (int i = 0; i < Owner.BlackBoard.ActionCount(); i++) { action = Owner.BlackBoard.ActionGet(i); if (action is AgentActionAttack && (action as AgentActionAttack).AttackPhaseDone == false) { return(false); } else if (action is AgentActionRoll) { return(false); } else if (action is AgentActionUseLever) { return(false); } else if (action is AgentActionGoTo && (action as AgentActionGoTo).Motion == E_MotionType.Sprint) { return(false); } } return(true); }
public void SetWSProperty(E_PropKey key, AgentOrder.E_OrderType value) { int index = (int)key; if (m_PropState[index] != null) { WorldStatePropFactory.Return(m_PropState[index]); } m_PropState[index] = WorldStatePropFactory.Create(key, value); m_PropBitSet.Set(index, true); // set info that key is set }
static public AgentOrder Create(AgentOrder.E_OrderType type) { AgentOrder o; if (m_UnusedOrders.Count > 0) { o = m_UnusedOrders.Dequeue(); o.Type = type; } else { o = new AgentOrder(type); } m_InAction.Add(o); return(o); }
public bool IsOrderAddPossible(AgentOrder.E_OrderType orderType) { AgentOrder.E_OrderType currentOrder = Owner.WorldState.GetWSProperty(E_PropKey.E_ORDER).GetOrder(); if (orderType == AgentOrder.E_OrderType.E_DODGE && currentOrder != AgentOrder.E_OrderType.E_DODGE && currentOrder != AgentOrder.E_OrderType.E_USE) { return(true); } else if (currentOrder != AgentOrder.E_OrderType.E_ATTACK && currentOrder != AgentOrder.E_OrderType.E_DODGE && currentOrder != AgentOrder.E_OrderType.E_USE) { return(true); } else { return(false); } }
static public WorldStateProp Create(E_PropKey key, AgentOrder.E_OrderType orderType) { WorldStateProp p = null; if (m_UnusedProps.Count > 0) { p = m_UnusedProps.Dequeue(); p.PropValue = new ValueOrder(orderType); p.PropType = E_PropType.E_EVENT; } else { p = new WorldStateProp(orderType); } p.Time = UnityEngine.Time.timeSinceLevelLoad; p.PropKey = key; return(p); }
public WorldStateProp(AgentOrder.E_OrderType order) { PropValue = new ValueOrder(order); PropType = E_PropType.E_ORDER; }
public ValueOrder(AgentOrder.E_OrderType order) { Order = order; }