Example #1
0
        protected void MoveDone(SimulationEvent ev)
        {//ObjectID, Reason
            String id = ((StringValue)ev["ObjectID"]).value;

            if (!_revealedObjects.ContainsKey(id))
            {
                return;
            }
            AttributeCollectionValue atts = new AttributeCollectionValue();

            atts.attributes.Add("DestinationLocation", new LocationValue());
            atts.attributes.Add("Throttle", DataValueFactory.BuildDouble(0));

            String owner = _revealedObjects[id].Owner;

            foreach (PolygonValue region in GetAllEntryRegions())
            {
                if (Polygon2D.IsPointInside(new Polygon2D(region), new Vec2D(GetSeamateObject(id).Location)) &&
                    owner == "Merchant DM")
                {
                    Console.WriteLine("Detected vessel " + id + " ending move in entry region, turning state to Dead.");
                    //atts.attributes.Add("State", DataValueFactory.BuildString("Dead"));
                    _dddConnection.SendStateChange(id, "Dead");
                }
            }


            //LocationValue destLoc =  as LocationValue;
            _revealedObjects[id].SetAttributes(atts);
        }
Example #2
0
        public void Start(DDDServerConnection serverConnection, DMView dmView)
        {
            m_dmView    = dmView;
            m_dddServer = serverConnection;


            m_dddServer.SendStateChange(m_thisID, m_newState);

            m_done = true;
        }