Exemplo n.º 1
0
        protected override Status Execute()
        {
            bool hasValues = blackboard.TryGetStructValue(m_framePropertyName, out int frame) &
                             blackboard.TryGetStructValue(m_durationPropertyName, out int duration);

            return(StateToStatusHelper.FinishedToStatus(frame - m_beginFrame >= duration, hasValues));
        }
Exemplo n.º 2
0
        protected override Status Execute()
        {
            Status childStatus = child.Tick();

            return(childStatus != Status.Success
                                ? childStatus
                                : StateToStatusHelper.FinishedToStatus(++m_currentRepeats >= m_repeats));
        }
Exemplo n.º 3
0
        protected override Status Execute()
        {
            if (m_agent != null)
            {
                bool arrived = !m_agent.pathPending && m_agent.remainingDistance <= m_agent.stoppingDistance;
                return(StateToStatusHelper.FinishedToStatus(arrived));
            }

            return(StateToStatusHelper.ConditionToStatus(m_dataValid, Status.Error, Status.Failure));
        }
Exemplo n.º 4
0
        public static void FinishedToStatusTest()
        {
            Assert.AreEqual(Status.Success, StateToStatusHelper.FinishedToStatus(true));
            Assert.AreEqual(Status.Running, StateToStatusHelper.FinishedToStatus(false));

            Assert.AreEqual(Status.Success, StateToStatusHelper.FinishedToStatus(true, true));
            Assert.AreEqual(Status.Running, StateToStatusHelper.FinishedToStatus(false, true));

            Assert.AreEqual(Status.Error, StateToStatusHelper.FinishedToStatus(true, false));
            Assert.AreEqual(Status.Error, StateToStatusHelper.FinishedToStatus(false, false));
        }
Exemplo n.º 5
0
        protected override Status Execute()
        {
            if (!blackboard.TryGetStructValue(m_repeatsPropertyName, out uint repeats))
            {
                return(Status.Error);
            }

            Status childStatus = child.Tick();

            return(childStatus != Status.Success
                                ? childStatus
                                : StateToStatusHelper.FinishedToStatus(++m_currentRepeats >= repeats));
        }
Exemplo n.º 6
0
        protected override Status Execute()
        {
            bool hasDuration = blackboard.TryGetStructValue(m_durationPropertyName, out float duration);

            return(StateToStatusHelper.FinishedToStatus(Time.time - m_beginTime >= duration, hasDuration));
        }
Exemplo n.º 7
0
 protected override Status Execute()
 {
     return(StateToStatusHelper.FinishedToStatus(Time.time - m_beginTime >= m_duration));
 }