コード例 #1
0
        private void HandleMovement(WowUnit target)
        {
            if (target == null)
            {
                return;
            }

            if (hasTargetMoved || (distanceToTarget < 6.0 && !BotMath.IsFacing(LastPlayerPosition, ObjectManager.Player.Rotation, LastTargetPosition, 0.75, 1.25)))
            {
                CharacterManager.MoveToPosition(LastTargetPosition);
            }
            else if (distanceToTarget >= 6.0)
            {
                if (computeNewRoute || MovementEngine.CurrentPath?.Count == 0)
                {
                    List <Vector3> path = PathfindingHandler.GetPath(ObjectManager.MapId, LastPlayerPosition, LastTargetPosition);
                    MovementEngine.LoadPath(path);
                    MovementEngine.PostProcessPath();
                }
                else
                {
                    if (MovementEngine.GetNextStep(LastPlayerPosition, ObjectManager.Player.Rotation, out Vector3 positionToGoTo, out bool needToJump))
                    {
                        CharacterManager.MoveToPosition(positionToGoTo);

                        if (needToJump)
                        {
                            CharacterManager.Jump();
                        }
                    }
                }
            }
        }
コード例 #2
0
        public static void Initialize()
        {
            try
            {
                ConcursosManager.seavItemsObject(); //Cargar los items que caen en salas
                TrampasManager.saveTrampasSala();   //Cargar las trampas de todas las salas

                LoginHandler.Start();
                FlowerHandler.Start();
                PocionesHandler.Start();
                CasasHandler.Start();
                NavigatorHandler.Start();
                NoticiasHandler.Start();
                BPadHandler.Start();
                CatalogoHandler.Start();
                ConcursosHandler.Start();
                PathfindingHandler.Start();
                IntercambiosHandler.Start();
                InterfazHandler.Start();
                IslasHandler.Start();
                MiniGamesHandler.Start();
                PingHandler.Start();
                npcHandler.Start();
                codigos_promocionales.Iniciar();
                Output.WriteLine("Se han registrado " + Handlers.Count + " handlers.");
                listas.automatic_lists_row();

                UserManager.obtenerUsuariosRegistrados();
            }
            catch (Exception e)
            {
                Program.EditorialResponse(e);
            }
        }
コード例 #3
0
ファイル: Handler.cs プロジェクト: cheezwork/STUDIO-1
    private void Awake()
    {
        //Set the player variable to the player in the scene
        player = GameObject.FindGameObjectWithTag("player");

        gameMng = GameObject.Find("GameManager").GetComponent <GameManagerHandler>();
        pathHnd = GameObject.Find("Pathfinder").GetComponent <PathfindingHandler>();

        //Set the agentRigidBody variable to the rigidbody attached to the gameobject which the handler is attached to
        agentRigidBody = gameObject.GetComponent <Rigidbody>();

        //Initialize the new behavior tree
        test = new BehaviorTree(this);

        //Add the root to the behavior tree
        test.AddRoot();

        test.DynamicAddNode(new SequenceSelector(0, "loneEvent", this), "root");

        test.DynamicAddNode(new VisionLeaf(0, "visionLone", this), "loneEvent");
        test.DynamicAddNode(new SoleInteractionLeaf(1, "loneInteraction", this), "loneEvent");

        //Add Sequence selector to handle the attack sequence
        test.DynamicAddNode(new SequenceSelector(1, "attackSequence", this), "root");

        //Attack Sequence Leaf Nodes
        test.DynamicAddNode(new VisionLeaf(0, "vision", this), "attackSequence");
        test.DynamicAddNode(new ChaseLeaf(1, "chase", this), "attackSequence");
        test.DynamicAddNode(new OpenDoorLeaf(2, "doorAttack", this), "attackSequence");
        test.DynamicAddNode(new AttackLeaf(3, "attack", this), "attackSequence");

        //Patrol Sequence
        test.DynamicAddNode(new SequenceSelector(2, "patrolSequence", this), "root");

        //Patrol Sequence Leaf Nodes
        test.DynamicAddNode(new OpenDoorLeaf(0, "doorPatrol", this), "patrolSequence");
        test.DynamicAddNode(new PatrolLeaf(1, "patrol", this), "patrolSequence");
    }
コード例 #4
0
        private void HandleMovement(WowUnit target)
        {
            if (target == null)
            {
                return;
            }
            if (HookManager.GetBuffs(WowLuaUnit.Player).Any(e => e.Contains("tealth")))
            {
                if (!wasInStealth || hasTargetMoved)
                {
                    isSneaky = true;
                }
                wasInStealth = true;
            }
            else
            {
                isSneaky     = false;
                wasInStealth = false;
            }
            if (distanceToBehindTarget < 3.0)
            {
                isSneaky = false;
            }
            bool closeToTarget = distanceToTarget < 10.0;

            if (hasTargetMoved)
            {
                CharacterManager.MoveToPosition(LastBehindTargetPosition);
            }
            else if (closeToTarget)
            {
                if (isSneaky)
                {
                    CharacterManager.MoveToPosition(LastBehindTargetPosition);
                }
                else if (!BotMath.IsFacing(LastPlayerPosition, ObjectManager.Player.Rotation, LastTargetPosition, 0.75, 1.25))
                {
                    CharacterManager.MoveToPosition(LastTargetPosition);
                }
            }
            else
            {
                if (computeNewRoute || MovementEngine.CurrentPath?.Count == 0)
                {
                    List <Vector3> path = PathfindingHandler.GetPath(ObjectManager.MapId, LastPlayerPosition, LastBehindTargetPosition);
                    MovementEngine.LoadPath(path);
                    MovementEngine.PostProcessPath();
                }
                else
                {
                    if (MovementEngine.GetNextStep(LastPlayerPosition, ObjectManager.Player.Rotation, out Vector3 positionToGoTo, out bool needToJump))
                    {
                        CharacterManager.MoveToPosition(positionToGoTo);

                        if (needToJump)
                        {
                            CharacterManager.Jump();
                        }
                    }
                }
            }
        }