Пример #1
0
        static void OnChangeTarget(ref ChangeTargetMsg msg, MyNetworkClient sender)
        {
            MyEntity entity;

            MyEntities.TryGetEntityById(msg.EntityId, out entity);
            var turret = entity as MyLargeTurretBase;

            if (turret != null)
            {
                MyEntity target = null;
                if (msg.Target != 0)
                {
                    MyEntities.TryGetEntityById(msg.Target, out target);
                }

                turret.SetTarget(target, msg.IsPotential);
            }
        }
Пример #2
0
 static void OnChangeTarget(ref ChangeTargetMsg msg, MyNetworkClient sender)
 {
     MyEntity entity;
     MyEntities.TryGetEntityById(msg.EntityId, out entity);
     var turret = entity as MyLargeTurretBase;
     if (turret != null)
     {
         MyEntity target = null;
         if (msg.Target != 0)
             MyEntities.TryGetEntityById(msg.Target, out target);
         
         turret.SetTarget(target, msg.IsPotential);                
     }
 }
Пример #3
0
        public void SendChangeTarget(long target, bool isPotentialTarget)
        {
            var msg = new ChangeTargetMsg();

            msg.EntityId = m_turret.EntityId;
            msg.Target = target;
            msg.IsPotential = isPotentialTarget;
  
            Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success);
        }