示例#1
0
        //[DebuggerStepThrough]
        public static void MoveUnitSphere(UnitData unit)
        {
            try
            {
                if (Players.UnitSpheres.Count > 0)
                {
                    Players.UnitSpheres[unit.UnitID].Center = new Point3D(unit.Location.X, unit.Location.Y, unit.Location.Z);
                }
                else
                {
                    Players.AddNew(unit.UnitID);
                    Players.UnitSpheres[unit.UnitID].Center = new Point3D(unit.Location.X, unit.Location.Y, unit.Location.Z);

                    if (Battle3DViewPort == null)
                    {
                        DrawCube();
                    }


                    Battle3DViewPort.Children.Add(Players.UnitSpheres.Last().Value);
                }
            }
            catch
            {
                Players.AddNew(unit.UnitID);
                Players.UnitSpheres[unit.UnitID].Center = new Point3D(unit.Location.X, unit.Location.Y, unit.Location.Z);

                if (Battle3DViewPort == null)
                {
                    DrawCube();
                }


                Battle3DViewPort.Children.Add(Players.UnitSpheres.Last().Value);
            }
        }