protected virtual void GetFood() { if (1.1f - m_Hunger < m_ActionCurrent.Priority) { m_ActionCurrent = null; return; } if (m_CurrentTarget == null) { int amount = Physics.OverlapSphereNonAlloc(transform.position, m_Personality.NeedDetection, m_NonAllocResults, m_FoodLayer); if (amount <= 0) { WanderRandomDirection(m_Personality.NeedDetection); return; } int index = 0; float min = Mathf.Infinity; for (int i = 0; i < amount; i++) { float mag = (m_NonAllocResults[i].transform.position - transform.position).sqrMagnitude; if (mag < min) { min = mag; index = i; } } SetNavmeshTarget(m_NonAllocResults[index].transform); } // ends current action }
public virtual bool ExecuteNextInterest() { if (m_ActionsInterests.Count > 0) { m_ActionCurrent = m_ActionsInterests[0]; m_ActionsInterests.Remove(m_ActionCurrent); m_ActionDelegates[m_ActionCurrent.Action](); return(true); } return(false); }
public virtual void RecieveOrder(BaseAIOrder order, bool Interrupt) { if (Interrupt && m_ActionCurrent != null) { m_ActionsNeeds.Add(m_ActionCurrent); return; } if (m_ActionCurrent == null) { m_ActionCurrent = order; return; } m_ActionsNeeds.Add(order); return; }
// Exectute Wander Action protected virtual void Wander() { // ends current action m_ActionCurrent = null; }
// Exectute Mate Action protected virtual void Mate() { // ends current action m_ActionCurrent = null; }