コード例 #1
0
ファイル: MapUtils.cs プロジェクト: PichotM/CodeWalker
 public void SetPosition(Vector3 newpos, bool editPivot)
 {
     if (MultipleSelection)
     {
         //don't do anything here for multiselection
     }
     else if (EntityDef != null)
     {
         if (editPivot)
         {
             EntityDef.SetPivotPositionFromWidget(newpos);
         }
         else
         {
             EntityDef.SetPositionFromWidget(newpos);
         }
     }
     else if (CarGenerator != null)
     {
         CarGenerator.SetPosition(newpos);
     }
     else if (PathNode != null)
     {
         PathNode.SetPosition(newpos);
     }
     else if (CollisionPoly != null)
     {
         CollisionPoly.Position = newpos;
     }
     else if (CollisionBounds != null)
     {
         CollisionBounds.Position = newpos;
     }
     else if (NavPoly != null)
     {
         NavPoly.SetPosition(newpos);
     }
     else if (NavPoint != null)
     {
         NavPoint.SetPosition(newpos);
     }
     else if (NavPortal != null)
     {
         NavPortal.SetPosition(newpos);
     }
     else if (TrainTrackNode != null)
     {
         TrainTrackNode.SetPosition(newpos);
     }
     else if (ScenarioNode != null)
     {
         ScenarioNode.SetPosition(newpos);
     }
     else if (Audio != null)
     {
         Audio.SetPosition(newpos);
     }
 }
コード例 #2
0
ファイル: MapUtils.cs プロジェクト: 5pHiNxX/CodeWalker
        public void SetPosition(Vector3 newpos, bool editPivot)
        {
            if (MultipleSelection)
            {
                //don't do anything here for multiselection
            }
            else if (EntityDef != null)
            {
                if (editPivot)
                {
                    EntityDef.SetPivotPositionFromWidget(newpos);
                }
                else
                {
                    EntityDef.SetPositionFromWidget(newpos);
                }
            }
            else if (CarGenerator != null)
            {
                CarGenerator.SetPosition(newpos);
            }
            else if (PathNode != null)
            {
                PathNode.SetPosition(newpos);
            }
            else if (NavPoly != null)
            {
                NavPoly.SetPosition(newpos);

                //if (projectForm != null)
                //{
                //    projectForm.OnWorldNavPolyModified(NavPoly);
                //}
            }
            else if (NavPoint != null)
            {
                NavPoint.SetPosition(newpos);
            }
            else if (NavPortal != null)
            {
                NavPortal.SetPosition(newpos);
            }
            else if (TrainTrackNode != null)
            {
                TrainTrackNode.SetPosition(newpos);
            }
            else if (ScenarioNode != null)
            {
                ScenarioNode.SetPosition(newpos);
            }
            else if (Audio != null)
            {
                Audio.SetPosition(newpos);
            }
        }
コード例 #3
0
ファイル: UndoStep.cs プロジェクト: asm512/CodeWalker
        private void Update(WorldForm wf, ref MapSelection sel, Vector3 p)
        {
            ScenarioNode?.SetPosition(p);

            if (ScenarioNode != sel.ScenarioNode)
            {
                wf.SelectScenarioNode(ScenarioNode);
            }
            wf.SetWidgetPosition(p);

            UpdateGraphics(wf);
        }
コード例 #4
0
 public void SetPosition(Vector3 newpos, bool editPivot)
 {
     if (MultipleSelectionItems != null)
     {
         if (editPivot)
         {
         }
         else
         {
             var dpos = newpos - MultipleSelectionCenter;// oldpos;
             if (dpos == Vector3.Zero)
             {
                 return;                       //nothing moved.. (probably due to snap)
             }
             for (int i = 0; i < MultipleSelectionItems.Length; i++)
             {
                 if (MultipleSelectionItems[i].CollisionPoly == null)//skip polys, they use gathered verts
                 {
                     var refpos = MultipleSelectionItems[i].WidgetPosition;
                     MultipleSelectionItems[i].SetPosition(refpos + dpos, false);
                 }
             }
             if (GatheredCollisionVerts != null)
             {
                 for (int i = 0; i < GatheredCollisionVerts.Length; i++)
                 {
                     var refpos = GatheredCollisionVerts[i].Position;
                     GatheredCollisionVerts[i].Position = refpos + dpos;
                 }
             }
             MultipleSelectionCenter = newpos;
         }
     }
     else if (EntityDef != null)
     {
         if (editPivot)
         {
             EntityDef.SetPivotPositionFromWidget(newpos);
         }
         else
         {
             EntityDef.SetPositionFromWidget(newpos);
         }
     }
     else if (CarGenerator != null)
     {
         CarGenerator.SetPosition(newpos);
     }
     else if (PathNode != null)
     {
         PathNode.SetPosition(newpos);
     }
     else if (CollisionVertex != null)
     {
         CollisionVertex.Position = newpos;
     }
     else if (CollisionPoly != null)
     {
         CollisionPoly.Position = newpos;
     }
     else if (CollisionBounds != null)
     {
         CollisionBounds.Position = newpos;
     }
     else if (NavPoly != null)
     {
         NavPoly.SetPosition(newpos);
     }
     else if (NavPoint != null)
     {
         NavPoint.SetPosition(newpos);
     }
     else if (NavPortal != null)
     {
         NavPortal.SetPosition(newpos);
     }
     else if (TrainTrackNode != null)
     {
         TrainTrackNode.SetPosition(newpos);
     }
     else if (ScenarioNode != null)
     {
         ScenarioNode.SetPosition(newpos);
     }
     else if (Audio != null)
     {
         Audio.SetPosition(newpos);
     }
 }