Example #1
0
        private void GetData()
        {
            if (helm.IsDead())
            {
                Die();
            }
            spaceGridControl.Ships    = client.GetVisibleShips();
            spaceGridControl.Stars    = client.GetStars();
            spaceGridControl.Missiles = client.GetVisibleMissiles();
            spaceGridControl.Origin   = helm.Position;
            spaceGridControl.Rotation = helm.Heading;
            var ship = spaceGridControl.Selected ?? helm;

            indicatorControl.Acceleration = ship.Acceleration;
            indicatorControl.Speed        = ship.Speed;
            indicatorControl.Position     = ship.Position;
            if (target == null)
            {
                labelBoard.Text = "Цель не выбрана";
            }
            else
            {
                left = helm.IsLeft(target);
                if (Math.Cos(helm.Roll) < 0)
                {
                    left = !left;
                }
                labelBoard.Text = left ? "Левый борт" : "Правый борт";
            }
        }
Example #2
0
 public View GetView(IHelm me)
 {
     lock (m_locker)
     {
         bool blind = me.IsDead() || !me.InSpace();
         return(new View
         {
             Time = Time,
             Helm = HelmDefinition.Store(me),
             Ships = blind ? new ShipDefinition[0] : GetVisibleShips(me).Select(ShipDefinition.Store).ToArray(),
             Missiles = blind ? new MissileDefinition[0] : GetVisibleMissiles(me).Select(MissileDefinition.Store).ToArray(),
             Stars = GetStars().ToArray(),
         });
     }
 }