Esempio n. 1
0
        public double Distance(String ob1, String ob2)
        {
            if (!AllObjects.ContainsKey(ob1) || !AllObjects.ContainsKey(ob2))
            {
                return(-1);
            }
            Vec3D ob1V = new Vec3D(AllObjects[ob1].Location);
            Vec3D ob2V = new Vec3D(AllObjects[ob2].Location);

            return(ob1V.ScalerDistanceTo(ob2V));
        }
Esempio n. 2
0
        internal void ViewProStopObjectUpdate(SimulationEvent ev)
        {
            String id = ((StringValue)ev["ObjectID"]).value;

            if (AllObjects.ContainsKey(id))
            {
                AllObjects[id].ShouldProject = false;
            }
            if (PlayerAgent != null)
            {
                PlayerAgent.ViewProStopObjectUpdate(ev);
            }
        }
Esempio n. 3
0
        internal void ViewProMotionUpdate(SimulationEvent ev)
        {
            String id = ((StringValue)ev["ObjectID"]).value;

            if (AllObjects.ContainsKey(id))
            {
                SimObject ob = AllObjects[id];
                ob.ShouldProject       = true;
                ob.Location            = ((LocationValue)ev["Location"]);
                ob.DestinationLocation = ((LocationValue)ev["DestinationLocation"]);
                ob.Throttle            = ((DoubleValue)ev["Throttle"]).value;
                ob.Velocity            = BehaviorHelper.ComputeVelocityVector(ob.Location, ob.DestinationLocation, ob.MaximumSpeed, ob.Throttle);
            }
            if (PlayerAgent != null)
            {
                PlayerAgent.ViewProMotionUpdate(ev);
            }
        }
Esempio n. 4
0
        internal void StateChange(SimulationEvent ev)
        {
            String id    = ((StringValue)ev["ObjectID"]).value;
            String state = ((StringValue)ev["NewState"]).value;

            if (AllObjects.ContainsKey(id))
            {
                AllObjects[id].State = state; // update based on this because view pro doesn't come out after its been killed
                if (state == "Dead")
                {
                    if (AllObjects[id].ControlAgent != null)
                    {
                        AllObjects[id].ControlAgent.ClearBehaviorQueue();
                    }
                }
            }

            if (PlayerAgent != null)
            {
                PlayerAgent.StateChange(ev);
            }
        }
Esempio n. 5
0
        //public WaypointRoute GenerateRoute(LocationValue currentLocation, LocationValue destination, List<WaypointRoute> routes)
        //{
        //    WaypointRoute result = null;

        //    LocationGraph graph = LocationGraph.GenerateRouteGraph("start",currentLocation, "end",destination, routes);

        //    result = graph.GenerateWaypointRoute("start","end");
        //    return result;
        //}

        internal void ViewProInitializeObject(SimulationEvent ev)
        {
            String    id = ((StringValue)ev["ObjectID"]).value;
            SimObject ob;

            if (AllObjects.ContainsKey(id))
            {
                ob = AllObjects[id];
            }
            else
            {
                ob = new SimObject(id);
            }
            ob.Owner    = ((StringValue)ev["OwnerID"]).value;
            ob.Location = ((LocationValue)ev["Location"]);
            ob.IconName = ((StringValue)ev["IconName"]).value;

            ob.IsWeapon = ((BooleanValue)ev["IsWeapon"]).value;
            if (ob.Owner == m_decisionMakerID)
            {
                m_myObjects[ob.ID] = ob;
            }
            else
            {
                if (m_myObjects.ContainsKey(id))
                {
                    m_myObjects.Remove(id);
                }
            }


            m_allObjects[ob.ID] = ob;

            if (PlayerAgent != null)
            {
                PlayerAgent.ViewProInitializeObject(ev);
            }
        }