Example #1
0
        static void TargetPositionRequest(ref TargetPositionMsg msg, MyNetworkClient sender)
        {
            MyEntity entity;

            MyEntities.TryGetEntityById(msg.EntityId, out entity);
            if (entity is MyLargeTurretBase)
            {
                Sync.Layer.SendMessageToAllAndSelf(ref msg, MyTransportMessageEnum.Success);
            }
        }
Example #2
0
        static void TargetPositionSuccess(ref TargetPositionMsg msg, MyNetworkClient sender)
        {
            MyEntity entity;

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

            if (turret != null)
            {
                turret.TargetPosition(msg.TargetPos, msg.TargetVelocity, msg.UsePrediction);
            }
        }
Example #3
0
        public void SendTargetPosition(Vector3D targetPos, Vector3?targetVelocity = null)
        {
            var msg = new TargetPositionMsg();

            msg.EntityId  = m_turret.EntityId;
            msg.TargetPos = targetPos;
            if (targetVelocity.HasValue)
            {
                msg.TargetVelocity = targetVelocity.Value;
                msg.UsePrediction  = true;
            }
            else
            {
                msg.UsePrediction = false;
            }

            Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request);
        }
 static void TargetPositionSuccess(ref TargetPositionMsg msg, MyNetworkClient sender)
 {
     MyEntity entity;
     MyEntities.TryGetEntityById(msg.EntityId, out entity);
     var turret = entity as MyLargeTurretBase;
     if (turret != null)
     {            
         turret.TargetPosition(msg.TargetPos,msg.TargetVelocity,msg.UsePrediction);
     }
 }
 static void TargetPositionRequest(ref TargetPositionMsg msg, MyNetworkClient sender)
 {
     MyEntity entity;
     MyEntities.TryGetEntityById(msg.EntityId, out entity);
     if (entity is MyLargeTurretBase)
     {
         Sync.Layer.SendMessageToAllAndSelf(ref msg, MyTransportMessageEnum.Success);
     }
 }
        public void SendTargetPosition(Vector3D targetPos,Vector3? targetVelocity = null)
        {
            var msg = new TargetPositionMsg();

            msg.EntityId = m_turret.EntityId;
            msg.TargetPos = targetPos;
            if (targetVelocity.HasValue)
            {
                msg.TargetVelocity = targetVelocity.Value;
                msg.UsePrediction = true;
            }
            else
            {
                msg.UsePrediction = false;
            }

            Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request);
        }