Esempio n. 1
0
        public void Behave()
        {
            if (IsGameObjectNull())
            {
                foreach (Toon toon in Map.GetToons())
                {
                    if (IsGameObjectInsideRange(toon, 300))
                    {
                        Client.SendEvent(new MoveToGameObjectEvent(GetId(), toon.GetId()));
                        MobState currentState = mobState;
                        currentState.IsActive = false;
                        mobState = new MoveToGameObjectMobState(toon, this);
                        mobState.NextState = currentState;
                    }
                }
            }

            if (mobState is MoveToGameObjectMobState)
            {
                HandleMobState((MoveToGameObjectMobState)mobState);
            }
            else if (mobState is MoveToPostionMobState)
            {
                HandleMobState((MoveToPostionMobState)mobState);
            }
            else if (mobState is IdleMobState)
            {
                HandleMobState((IdleMobState)mobState);
            }
        }
Esempio n. 2
0
        public void HandleMobState(MoveToGameObjectMobState leState)
        {
            if (!IsGameObjectNull() && !IsGameObjectInsideRange(leState.GoalGameObject, 600))
            {
                Console.WriteLine("Cat not chasing no more");
                goalGameObject = null;
            }

            if (!leState.IsActive)
            {
                leState.Activate();
            }
            else if (leState.CheckState())
            {
                leState.IsActive = false;
                mobState = leState.NextState;
            }
        }