BehaveResult Tick(Tree sender) { if (!GetData <Data>(sender, ref m_Data)) { return(BehaveResult.Failure); } BehaveGroup group = sender.ActiveAgent as BehaveGroup; if (group == null || group.Leader == null) { return(BehaveResult.Failure); } if (group.HasAttackEnemy() || group.HasEscapeEnemy()) { return(BehaveResult.Failure); } if (Time.time - m_Data.m_StartIdleTime > m_Data.m_CurrentIdleTime) { return(BehaveResult.Success); } group.PauseMemberBehave(false); return(BehaveResult.Running); }
BehaveResult Init(Tree sender) { if (!GetData <Data>(sender, ref m_Data)) { return(BehaveResult.Failure); } BehaveGroup group = sender.ActiveAgent as BehaveGroup; if (group == null || group.Leader == null) { return(BehaveResult.Failure); } if (Random.value > m_Data.prob) { return(BehaveResult.Failure); } m_Data.m_StartPatrolTime = Time.time; m_Data.m_LastSwitchTime = 0.0f; m_Data.m_Time = Random.Range(m_Data.minTime, m_Data.maxTime); m_Data.m_SwitchTime = Random.Range(5.0f, 10.0f); group.PauseMemberBehave(true); return(BehaveResult.Running); }
BehaveResult Tick(Tree sender) { BehaveGroup group = sender.ActiveAgent as BehaveGroup; if (group == null || group.Leader == null) { return(BehaveResult.Failure); } if (group.HasAttackEnemy()) { group.PauseMemberBehave(false); return(BehaveResult.Running); } else { return(BehaveResult.Failure); } }
BehaveResult Init(Tree sender) { BehaveGroup group = sender.ActiveAgent as BehaveGroup; if (group == null || group.Leader == null) { return(BehaveResult.Failure); } if (!group.HasEscapeEnemy()) { return(BehaveResult.Failure); } //m_StartTime = Time.time; m_LastRandomTime = 0.0f; group.PauseMemberBehave(true); return(BehaveResult.Running); }