示例#1
0
        protected override MyMwcObjectBuilder_Base GetObjectBuilderInternal(bool getExactCopy)
        {
            MyMwcObjectBuilder_WaypointNew ob = (MyMwcObjectBuilder_WaypointNew)base.GetObjectBuilderInternal(getExactCopy);

            ob.GroupNames    = new List <string>();
            ob.GroupPlacings = new List <int>();
            foreach (var path in Paths())
            {
                System.Diagnostics.Debug.Assert(path.Name.Length <= MyWaypointConstants.MAXIMUM_WAYPOINT_PATH_NAME_LENGTH);
                ob.GroupNames.Add(path.Name);
                ob.GroupPlacings.Add(path.WayPoints.IndexOf(this));
            }

            ob.NeighborEntityIds = new List <int>();
            using (MyWayPoint.NeighborsLock.AcquireSharedUsing())
            {
                foreach (var neighbor in Neighbors)
                {
                    var id = neighbor.EntityId;
                    System.Diagnostics.Debug.Assert(id != null);
                    ob.NeighborEntityIds.Add((int)id.Value.NumericValue);
                }
            }

            ob.ParentEntityId = (Parent == null || Parent.EntityId == null) ? null : (int?)Parent.EntityId.Value.NumericValue;

            return(ob);
        }
示例#2
0
        public virtual void Init(string hudLabelText, MyMwcObjectBuilder_WaypointNew ob, Matrix matrix)
        {
            StringBuilder hudLabelTextSb = (hudLabelText == null) ? null : new StringBuilder(hudLabelText);

            base.Init(hudLabelTextSb, ob);

            objectBuilder = ob;

            SetWorldMatrix(matrix);

            MyWayPointGraph.AddVertex(this);

            this.LocalVolume = new BoundingSphere(Vector3.Zero, MAX_RADIUS_WAYPOINT);
            //VisibleInGame = false;
            Visible     = true;
            Flags      |= EntityFlags.EditableInEditor;
            CastShadows = false;
            UpdateRenderObject(Visible);
        }