Ejemplo n.º 1
0
        private static void MissileCreatedSuccess(ref MissileShootMsg msg, MyNetworkClient sender)
        {
            MyEntity shootingEntity;
            MyEntities.TryGetEntityById(msg.LauncherEntityId, out shootingEntity);
            Debug.Assert(shootingEntity != null, "Could not find missile shooting entity");
            if (shootingEntity == null)
                return;

            var shootingLauncher = shootingEntity as IMyMissileGunObject;
            Debug.Assert(shootingLauncher != null, "Shooting entity was not an IMyMissileGunObject");
            if (shootingLauncher == null)
                return;

            shootingLauncher.ShootMissile(msg.InitialVelocity);
        }
Ejemplo n.º 2
0
        public static void SendMissileCreated(IMyMissileGunObject launcher, Vector3 position, Vector3 initialVelocity, Vector3 direction, float customMaxDistance, MyAmmoBase.MyAmmoBaseFlags flags, long owner)
        {
            Debug.Assert(Sync.IsServer, "Only server can shoot missiles!");
            Debug.Assert(launcher is MyEntity, "Missile launching object should be an entity!");

            if (!Sync.IsServer || !(launcher is MyEntity))
                return;

            MissileShootMsg msg = new MissileShootMsg();
            msg.Position = position;
            msg.InitialVelocity = initialVelocity;
            msg.Direction = direction;
            msg.CustomMaxDistance = customMaxDistance;
            msg.Flags = flags;
            msg.LauncherEntityId = (launcher as MyEntity).EntityId;
            msg.Owner = owner;

            Sync.Layer.SendMessageToAll(ref msg);
        }
Ejemplo n.º 3
0
        private static void MissileCreatedSuccess(ref MissileShootMsg msg, MyNetworkClient sender)
        {
            MyEntity shootingEntity;

            MyEntities.TryGetEntityById(msg.LauncherEntityId, out shootingEntity);
            Debug.Assert(shootingEntity != null, "Could not find missile shooting entity");
            if (shootingEntity == null)
            {
                return;
            }

            var shootingLauncher = shootingEntity as IMyMissileGunObject;

            Debug.Assert(shootingLauncher != null, "Shooting entity was not an IMyMissileGunObject");
            if (shootingLauncher == null)
            {
                return;
            }

            shootingLauncher.ShootMissile(msg.InitialVelocity);
        }
Ejemplo n.º 4
0
        public static void SendMissileCreated(IMyMissileGunObject launcher, Vector3 position, Vector3 initialVelocity, Vector3 direction, float customMaxDistance, MyAmmoBase.MyAmmoBaseFlags flags, long owner)
        {
            Debug.Assert(Sync.IsServer, "Only server can shoot missiles!");
            Debug.Assert(launcher is MyEntity, "Missile launching object should be an entity!");

            if (!Sync.IsServer || !(launcher is MyEntity))
            {
                return;
            }

            MissileShootMsg msg = new MissileShootMsg();

            msg.Position          = position;
            msg.InitialVelocity   = initialVelocity;
            msg.Direction         = direction;
            msg.CustomMaxDistance = customMaxDistance;
            msg.Flags             = flags;
            msg.LauncherEntityId  = (launcher as MyEntity).EntityId;
            msg.Owner             = owner;

            Sync.Layer.SendMessageToAll(msg);
        }