Example #1
0
        void MoveTo(string message)
        {
            try
            {
                int pos = message.IndexOf(";");
                message = message.Substring(pos + 1);

                pos = message.IndexOf(";");
                int sourceNum = int.Parse(message.Substring(0, pos));
                message = message.Substring(pos + 1);

                pos = message.IndexOf(";");
                float x = float.Parse(message.Substring(0, pos));
                message = message.Substring(pos + 1);

                pos = message.IndexOf(";");
                float y = float.Parse(message.Substring(0, pos));

                Ship sourceShip = null;

                ItemManager <Ship> ships = world.Ships;
                foreach (Ship ship in ships)
                {
                    if (ship.ID == sourceNum)
                    {
                        sourceShip = ship;
                        break;
                    }
                }

                if ((sourceShip != null) && (sourceShip.Faction.FactionID == faction))
                {
                    sourceShip.MoveTo(new Vector2(x, y));
                    repController.getMoveTo(sourceNum, x, y, world.timeManager.getTimeStringforRecord());
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }