コード例 #1
0
        private static void OnAttach(MySyncMotorBase block, ref AttachMsg msg, MyNetworkClient sender)
        {
            MyMotorBase stator = (MyMotorBase)block.Entity;
            MyEntity rotorEntity = null;
            if (!MyEntities.TryGetEntityById(msg.AttachableEntityId, out rotorEntity))
            {
                Debug.Assert(false, "Could not find rotor entity to attach to stator");
                return;
            }
            MyMotorRotor rotor = (MyMotorRotor)rotorEntity;

            Debug.Assert(stator.CubeGrid != rotor.CubeGrid, "Trying to attach rotor to stator on the same grid");

            stator.Attach(rotor);
        }
コード例 #2
0
        private static void OnAttach(MySyncMotorBase block, ref AttachMsg msg, MyNetworkClient sender)
        {
            MyMotorBase stator      = (MyMotorBase)block.Entity;
            MyEntity    rotorEntity = null;

            if (!MyEntities.TryGetEntityById(msg.AttachableEntityId, out rotorEntity))
            {
                Debug.Assert(false, "Could not find rotor entity to attach to stator");
                return;
            }
            MyMotorRotor rotor = (MyMotorRotor)rotorEntity;

            Debug.Assert(stator.CubeGrid != rotor.CubeGrid, "Trying to attach rotor to stator on the same grid");

            stator.Attach(rotor);
        }