private void PostCharacterMovedEvent(
            RequestCache requestCache)
        {
            // Add a game event if the player is moving to the portal
            if (m_move_to_target)
            {
                GameEventParameters gameEvent =
                    new GameEvent_CharacterMoved()
                {
                    character_id = m_character_id,
                    room_x       = m_current_room_key.x,
                    room_y       = m_current_room_key.y,
                    room_z       = m_current_room_key.z,
                    from_x       = m_current_character_position.x,
                    from_y       = m_current_character_position.y,
                    from_z       = m_current_character_position.z,
                    from_angle   = m_current_character_angle,
                    to_x         = m_energy_tank.Position.x,
                    to_y         = m_energy_tank.Position.y,
                    to_z         = m_energy_tank.Position.z,
                    to_angle     = MathConstants.GetAngleForDirection(MathConstants.eDirection.down)
                };

                GameEventQueries.AddEvent(requestCache.DatabaseContext, m_game_id, gameEvent);

                m_ai_relevant_events.Add(gameEvent);
            }
        }
        private bool ComputePlayerPaths(
            out string result_code)
        {
            PathComputer pathComputer = new PathComputer();
            bool         success      = true;

            result_code = SuccessMessages.GENERAL_SUCCESS;

            foreach (GameEventParameters gameEvent in m_relevantGameEvents)
            {
                if (gameEvent.GetEventType() == eGameEventType.character_moved)
                {
                    GameEvent_CharacterMoved movedEvent = (GameEvent_CharacterMoved)gameEvent;

                    success =
                        pathComputer.BlockingPathRequest(
                            m_room.runtime_nav_mesh,
                            m_room.room_key,
                            new Point3d((float)movedEvent.from_x, (float)movedEvent.from_y, (float)movedEvent.from_z),
                            new Point3d((float)movedEvent.to_x, (float)movedEvent.to_y, (float)movedEvent.to_z));

                    if (success)
                    {
                        m_playerPaths.Add(
                            new EntityPath()
                        {
                            entity_id = movedEvent.character_id,
                            path      = pathComputer.FinalPath
                        });
                    }
                    else
                    {
                        result_code = ErrorMessages.CANT_COMPUTE_PATH;
                        break;
                    }
                }
            }

            return(success);
        }
        private void PostCharacterMovedEvent(
            RequestCache requestCache)
        {
            GameEventParameters gameEvent =
                new GameEvent_CharacterMoved()
            {
                character_id = m_character_id,
                room_x       = m_current_room_key.x,
                room_y       = m_current_room_key.y,
                room_z       = m_current_room_key.z,
                from_x       = m_current_character_position.x,
                from_y       = m_current_character_position.y,
                from_z       = m_current_character_position.z,
                from_angle   = m_current_character_angle,
                to_x         = m_target_position.x,
                to_y         = m_target_position.y,
                to_z         = m_target_position.z,
                to_angle     = m_target_angle
            };

            // Add a game event if the player is moving to the portal
            GameEventQueries.AddEvent(requestCache.DatabaseContext, m_game_id, gameEvent);
            m_ai_relevant_events.Add(gameEvent);
        }
        private void PostCharacterMovedEvent(
            RequestCache requestCache)
        {
            // Add a game event if the player is moving to the portal
            if (m_move_to_target)
            {
                GameEventParameters gameEvent =
                    new GameEvent_CharacterMoved()
                        {
                            character_id = m_character_id,
                            room_x = m_current_room_key.x,
                            room_y = m_current_room_key.y,
                            room_z = m_current_room_key.z,
                            from_x = m_current_character_position.x,
                            from_y = m_current_character_position.y,
                            from_z = m_current_character_position.z,
                            from_angle = m_current_character_angle,
                            to_x = m_energy_tank.Position.x,
                            to_y = m_energy_tank.Position.y,
                            to_z = m_energy_tank.Position.z,
                            to_angle = MathConstants.GetAngleForDirection(MathConstants.eDirection.down)
                        };

                GameEventQueries.AddEvent(requestCache.DatabaseContext, m_game_id, gameEvent);

                m_ai_relevant_events.Add(gameEvent);
            }
        }
Ejemplo n.º 5
0
        private void PostCharacterMovedEvent(
            RequestCache requestCache)
        {
            GameEventParameters gameEvent=
                new GameEvent_CharacterMoved()
                    {
                        character_id = m_character_id,
                        room_x = m_current_room_key.x,
                        room_y = m_current_room_key.y,
                        room_z = m_current_room_key.z,
                        from_x = m_current_character_position.x,
                        from_y = m_current_character_position.y,
                        from_z = m_current_character_position.z,
                        from_angle = m_current_character_angle,
                        to_x = m_target_position.x,
                        to_y = m_target_position.y,
                        to_z = m_target_position.z,
                        to_angle = m_target_angle
                    };

            // Add a game event if the player is moving to the portal
            GameEventQueries.AddEvent(requestCache.DatabaseContext, m_game_id, gameEvent);
            m_ai_relevant_events.Add(gameEvent);
        }