示例#1
0
 public MyBotNavigation()
 {
     this.m_path = new MyPathSteering(this);
     this.m_steerings.Add(this.m_path);
     this.m_aiming            = new MyBotAiming(this);
     this.m_stuckDetection    = new MyStuckDetection(0.05f, MathHelper.ToRadians((float)2f));
     this.m_destinationSphere = new MyDestinationSphere(ref Vector3D.Zero, 0f);
     this.m_wasStopped        = false;
 }
示例#2
0
 public void GenerateNavmeshTile(Vector3D?target)
 {
     if (target != null)
     {
         Vector3D            vectord2;
         float               num;
         IMyEntity           entity;
         MyDestinationSphere end = new MyDestinationSphere(ref target.Value + 0.1f, 1f);
         Static.Pathfinding.FindPathGlobal(target.Value - 0.10000000149011612, end, null).GetNextTarget(target.Value, out vectord2, out num, out entity);
     }
     this.DebugTarget = target;
 }
示例#3
0
        protected MyBehaviorTreeState GoToPlayerDefinedTarget()
        {
            if (m_debugTarget != MyAIComponent.Static.DebugTarget)
            {
                m_debugTarget = MyAIComponent.Static.DebugTarget;

                if (MyAIComponent.Static.DebugTarget.HasValue)
                {
                    ;//CyberhoundTarget.SetTargetPosition(MyAIComponent.Static.DebugTarget.Value);
                }
                else
                {
                    return(MyBehaviorTreeState.FAILURE);
                }
            }

            var botPosition = Bot.Player.Character.PositionComp.GetPosition();

            // Distance to target
            if (m_debugTarget != null)
            {
                if (Vector3D.Distance(botPosition, m_debugTarget.Value) <= 1f)
                {
                    return(MyBehaviorTreeState.SUCCESS);
                }

                //var nextPoint = MyAIComponent.Static.PathEngineGetNextPathPoint(botPosition, MyAIComponent.Static.DebugTarget.Value);
                //var nextPoint = MyAIComponent.Static.PathfindingGetNextPathPoint(botPosition, m_debugTarget.Value);
                Vector3D            point      = m_debugTarget.Value;
                MyDestinationSphere destSphere = new MyDestinationSphere(ref point, 1);
                var path = MyAIComponent.Static.Pathfinding.FindPathGlobal(botPosition, destSphere, null);

                Vector3D nextPoint;
                float    targetRadius;
                VRage.ModAPI.IMyEntity entity;
                if (path.GetNextTarget(botPosition, out nextPoint, out targetRadius, out entity))
                {
                    if (WolfTarget.TargetPosition != nextPoint)
                    {
                        //WolfTarget.SetTargetPosition(m_debugTarget.Value/*nextPoint*/);
                        WolfTarget.SetTargetPosition(nextPoint);
                    }
                    WolfTarget.AimAtTarget();
                    WolfTarget.GotoTargetNoPath(0.0f, false);
                }
                else
                {
                    return(MyBehaviorTreeState.FAILURE);
                }
            }
            return(MyBehaviorTreeState.RUNNING);
        }
示例#4
0
        public MyBotNavigation()
        {
            m_steerings = new List <MySteeringBase>();

            m_path = new MyPathSteering(this);
            m_steerings.Add(m_path);

            //m_steerings.Add(new MyCollisionDetectionSteering(this));

            m_aiming         = new MyBotAiming(this);
            m_stuckDetection = new MyStuckDetection();

            m_destinationSphere = new MyDestinationSphere(ref Vector3D.Zero, 0.0f);
        }
示例#5
0
        public MyBotNavigation()
        {
            m_steerings = new List <MySteeringBase>();

            m_path = new MyPathSteering(this);
            m_steerings.Add(m_path);

            //m_steerings.Add(new MyCollisionDetectionSteering(this));

            m_aiming         = new MyBotAiming(this);
            m_stuckDetection = new MyStuckDetection(0.01f, MathHelper.ToRadians(2f));

            m_destinationSphere = new MyDestinationSphere(ref Vector3D.Zero, 0.0f);

            m_wasStopped = false;
        }
示例#6
0
        public void GenerateNavmeshTile(Vector3D? target)
        {
            if (target.HasValue)
            {
                Vector3D point = target.Value + 0.1f;
                MyDestinationSphere destSphere = new MyDestinationSphere(ref point, 1);

                var path = Static.Pathfinding.FindPathGlobal(target.Value - 0.1f, destSphere, null);
                Vector3D nextPosition;
                float targetRadius;
                VRage.ModAPI.IMyEntity entity;
                path.GetNextTarget(target.Value, out nextPosition, out targetRadius, out entity);
            }

            DebugTarget = target;
        }