public override TickResult Tick(AgentMemory am)
        {
            if (am.IsRunning(ID) == false)
            {
                am.SetInt(ID, "lastRunningNode", 0);
                am.StartRunning(ID);
            }

            for (int node = am.GetInt(ID, "lastRunningNode", 0); node < Children.Count; node++)
            {
                TickResult result = TickChild(Children[node], am);

                if (result == TickResult.Success)
                {
                    // Sprawdzamy następny
                    continue;
                }
                else if (result == TickResult.Running)
                {
                    am.SetInt(ID, "lastRunningNode", node);
                    return(result);
                }
                else
                {
                    // Porażka lub błąd - zaczynamy od nowa
                    am.StopRunning(ID);
                    return(result);
                }
            }

            am.StopRunning(ID);
            return(TickResult.Success);
        }
        public override TickResult Tick(AgentMemory agentMemory)
        {
            if (agentMemory.IsRunning(ID) == false)
            {
                agentMemory.SetInt(ID, "lastRunningNode", 0);
                agentMemory.StartRunning(ID);
            }

            for (int node = agentMemory.GetInt(ID, "lastRunningNode", 0); node < Children.Count; node++)
            {
                TickResult result = TickChild(Children[node], agentMemory);

                if (result == TickResult.Failure)
                {
                    continue;
                }
                else if (result == TickResult.Running)
                {
                    agentMemory.SetInt(ID, "lastRunningNode", node);
                    return(result);
                }
                else
                {
                    agentMemory.StopRunning(ID);
                    return(result);
                }
            }

            agentMemory.StopRunning(ID);
            return(TickResult.Failure);
        }
예제 #3
0
        public TickResult Tick(AgentMemory agentMemory)
        {
            agentMemory.ResetActiveNodesList();
            agentMemory.ProcessTimers(agentMemory.DeltaTime);
            agentMemory.CurrentTree = this;

            TickResult result = Node.TickChild(Root, agentMemory);

            return(result);
        }
예제 #4
0
        public override TickResult Tick(AgentMemory agentMemory)
        {
            TickResult result;

            do
            {
                result = TickChild(Child, agentMemory);
            }while (result == TickResult.Success || result == TickResult.Running);

            return(result);
        }
예제 #5
0
        public override TickResult Tick(AgentMemory am)
        {
            for (int i = 0; i < Children.Count; i++)
            {
                TickResult result = TickChild(Children[i], am);

                if (result != TickResult.Success)
                {
                    return(result);
                }
            }

            return(TickResult.Success);
        }
예제 #6
0
        public override TickResult Tick(AgentMemory agentMemory)
        {
            TickResult result = TickChild(Child, agentMemory);

            if (result == TickResult.Failure)
            {
                return(TickResult.Success);
            }
            else if (result == TickResult.Success)
            {
                return(TickResult.Failure);
            }
            else
            {
                return(result);
            }
        }
예제 #7
0
        public override TickResult Tick(AgentMemory agentMemory)
        {
            for (int i = 0; i < Children.Count; i++)
            {
                TickResult result = TickChild(Children[i], agentMemory);

                if (result == TickResult.Failure)
                {
                    continue;
                }
                else
                {
                    return(result);
                }
            }

            return(TickResult.Failure);
        }
예제 #8
0
        public override TickResult Tick(AgentMemory agentMemory)
        {
            if (agentMemory.IsRunning(ID) == false)
            {
                agentMemory.SetFloat(ID, "timer", waitingTime);
                agentMemory.StartRunning(ID);
            }

            float timer = agentMemory.GetFloat(ID, "timer", 0f);

            timer -= agentMemory.DeltaTime;
            agentMemory.SetFloat(ID, "timer", timer);

            if (timer <= 0)
            {
                agentMemory.StopRunning(ID);
                return(TickResult.Success);
            }
            else
            {
                return(TickResult.Running);
            }
        }
 public override TickResult Tick(AgentMemory agentMemory)
 {
     return(TickResult.Failure);
 }
 public override TickResult Tick(AgentMemory am)
 {
     System.Diagnostics.Trace.WriteLine(message);
     return(TickResult.Success);
 }
예제 #11
0
 public override TickResult Tick(AgentMemory agentMemory)
 {
     return(TickResult.Success);
 }