コード例 #1
0
 public MyMwcObjectBuilder_Drone(
     MyMwcObjectBuilder_Drone_TypesEnum droneType = MyMwcObjectBuilder_Drone_TypesEnum.DroneUS, 
     MyMwcObjectBuilder_FactionEnum faction = MyMwcObjectBuilder_FactionEnum.None)
     :this()
 {
     DroneType = droneType;
     Faction = faction;
 }
コード例 #2
0
 public MyMwcObjectBuilder_Drone(
     MyMwcObjectBuilder_Drone_TypesEnum droneType = MyMwcObjectBuilder_Drone_TypesEnum.DroneUS,
     MyMwcObjectBuilder_FactionEnum faction       = MyMwcObjectBuilder_FactionEnum.None)
     : this()
 {
     DroneType = droneType;
     Faction   = faction;
 }
コード例 #3
0
        private bool ReadCurrent(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion)
        {
            var droneType = MyMwcMessageIn.ReadByteEx(binaryReader, senderEndPoint);

            if (droneType == null)
            {
                return(false);
            }
            DroneType = (MyMwcObjectBuilder_Drone_TypesEnum)droneType.Value;
            MyMwcLog.IfNetVerbose_AddToLog("DroneType: " + DroneType);

            return(true);
        }
コード例 #4
0
        private bool Read01085002(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion)
        {
            var droneType = MyMwcMessageIn.ReadByteEx(binaryReader, senderEndPoint);

            if (droneType == null)
            {
                return(false);
            }
            DroneType = (MyMwcObjectBuilder_Drone_TypesEnum)droneType.Value;
            MyMwcLog.IfNetVerbose_AddToLog("DroneType: " + DroneType);

            // Owner Ship
            bool?hasId = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint);

            if (!hasId.HasValue)
            {
                return(NetworkError());                 // Cannot read bool - whether owner entity id is null or not
            }
            MyMwcLog.IfNetVerbose_AddToLog("MyMwcObjectBuilder_Drone.OwnerEntityId.HasValue: " + hasId.Value);

            // Testing whether owner entity id is null
            if (hasId.Value)
            {
                // entity id has value - read the value
                uint?ownerEntityID = MyMwcMessageIn.ReadUInt32Ex(binaryReader, senderEndPoint);
                if (!ownerEntityID.HasValue)
                {
                    return(NetworkError());                         // Cannot read owner entity ID
                }
                MyMwcLog.IfNetVerbose_AddToLog("MyMwcObjectBuilder_Drone.OwnerEntityId.Value: " + ownerEntityID.Value);
                this.OwnerId = ownerEntityID.Value;
            }
            else
            {
                this.OwnerId = null;
            }

            return(true);
        }
コード例 #5
0
        private static MyModelsEnum GetModelLod0Enum(MyMwcObjectBuilder_Drone_TypesEnum droneType)
        {
            MyModelsEnum modelLod0Enum;

            switch (droneType)
            {
            case MyMwcObjectBuilder_Drone_TypesEnum.DroneUS:
                modelLod0Enum = MyModelsEnum.DroneUS;
                break;

            case MyMwcObjectBuilder_Drone_TypesEnum.DroneCN:
                modelLod0Enum = MyModelsEnum.DroneCN;
                break;

            case MyMwcObjectBuilder_Drone_TypesEnum.DroneSS:
                modelLod0Enum = MyModelsEnum.DroneSS;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(modelLod0Enum);
        }
コード例 #6
0
        private void InitPhysics(MyMwcObjectBuilder_Drone_TypesEnum droneType)
        {
            // TODO constants

            switch (droneType)
            {
            case MyMwcObjectBuilder_Drone_TypesEnum.DroneUS:
                m_shipTypeProperties.Physics = new MyShipTypePhysicsProperties
                {
                    Mass = 750,
                    MultiplierMovement                     = 1f,
                    MultiplierForwardBackward              = 420,
                    MultiplierStrafe                       = 420,
                    MultiplierStrafeRotation               = 1.2f,
                    MultiplierUpDown                       = 420,
                    MultiplierRoll                         = 0.15f,
                    MultiplierRotation                     = 0.14f,
                    MultiplierRotationEffect               = 0.05f,
                    MultiplierRotationDecelerate           = 1.85f,
                    MultiplierHorizontalAngleStabilization = 21f,
                    MaxAngularVelocity                     = 20f,
                };
                break;

            case MyMwcObjectBuilder_Drone_TypesEnum.DroneCN:
                m_shipTypeProperties.Physics = new MyShipTypePhysicsProperties
                {
                    Mass = 1000,
                    MultiplierMovement                     = 1f,
                    MultiplierForwardBackward              = 420,
                    MultiplierStrafe                       = 420,
                    MultiplierStrafeRotation               = 1.2f,
                    MultiplierUpDown                       = 420,
                    MultiplierRoll                         = 0.15f,
                    MultiplierRotation                     = 0.14f,
                    MultiplierRotationEffect               = 0.05f,
                    MultiplierRotationDecelerate           = 1.85f,
                    MultiplierHorizontalAngleStabilization = 21f,
                    MaxAngularVelocity                     = 20f,
                };
                break;

            case MyMwcObjectBuilder_Drone_TypesEnum.DroneSS:
                m_shipTypeProperties.Physics = new MyShipTypePhysicsProperties
                {
                    Mass = 500,
                    MultiplierMovement                     = 1f,
                    MultiplierForwardBackward              = 420,
                    MultiplierStrafe                       = 420,
                    MultiplierStrafeRotation               = 1.2f,
                    MultiplierUpDown                       = 420,
                    MultiplierRoll                         = 0.30f,
                    MultiplierRotation                     = 0.05f,
                    MultiplierRotationEffect               = 0.04f,
                    MultiplierRotationDecelerate           = 0.85f,
                    MultiplierHorizontalAngleStabilization = 21f,
                    MaxAngularVelocity                     = 20f,
                };
                break;

            default:
                throw new ArgumentOutOfRangeException("droneType");
            }

            m_shipTypeProperties.PhysicsForBot = m_shipTypeProperties.Physics;

            var center = ModelLod0.BoundingBox.GetCenter();
            var size   = MyDroneConstants.DRONE_PHYSICS_SIZE_MULTIPLIER * ModelLod0.BoundingBoxSize;

            InitBoxPhysics(MyMaterialType.METAL, center, size, m_shipTypeProperties.Physics.Mass,
                           MyPhysicsConfig.DefaultAngularDamping,
                           MyConstants.COLLISION_LAYER_DEFAULT, RigidBodyFlag.RBF_DEFAULT);

            this.Physics.Type = MyConstants.RIGIDBODY_TYPE_SHIP;
            this.Physics.PlayCollisionCueEnabled = true;
            //this.Physics.MaxLinearVelocity = m_shipTypeProperties.Physics.MaxSpeed;
            this.Physics.LinearDamping = MyPhysicsConfig.DefaultLinearDamping;
            this.Physics.Enabled       = true;

            Config.AutoLeveling.SetOn();
        }
コード例 #7
0
        private bool Read01085002(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion)
        {
            var droneType = MyMwcMessageIn.ReadByteEx(binaryReader, senderEndPoint);
            if (droneType == null) return false;
            DroneType = (MyMwcObjectBuilder_Drone_TypesEnum) droneType.Value;
            MyMwcLog.IfNetVerbose_AddToLog("DroneType: " + DroneType);

            // Owner Ship
            bool? hasId = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint);
            if (!hasId.HasValue) return NetworkError(); // Cannot read bool - whether owner entity id is null or not
            MyMwcLog.IfNetVerbose_AddToLog("MyMwcObjectBuilder_Drone.OwnerEntityId.HasValue: " + hasId.Value);

            // Testing whether owner entity id is null
            if (hasId.Value)
            {
                // entity id has value - read the value
                uint? ownerEntityID = MyMwcMessageIn.ReadUInt32Ex(binaryReader, senderEndPoint);
                if (!ownerEntityID.HasValue) return NetworkError(); // Cannot read owner entity ID

                MyMwcLog.IfNetVerbose_AddToLog("MyMwcObjectBuilder_Drone.OwnerEntityId.Value: " + ownerEntityID.Value);
                this.OwnerId = ownerEntityID.Value;
            }
            else
            {
                this.OwnerId = null;
            }

            return true;
        }
コード例 #8
0
        private bool ReadCurrent(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion)
        {
            var droneType = MyMwcMessageIn.ReadByteEx(binaryReader, senderEndPoint);
            if (droneType == null) return false;
            DroneType = (MyMwcObjectBuilder_Drone_TypesEnum)droneType.Value;
            MyMwcLog.IfNetVerbose_AddToLog("DroneType: " + DroneType);

            return true;
        }
コード例 #9
0
 internal override void SetObjectBuilderIdInternal(int? objectBuilderId)
 {
     DroneType = (MyMwcObjectBuilder_Drone_TypesEnum)objectBuilderId;
 }
コード例 #10
0
 internal override void SetObjectBuilderIdInternal(int?objectBuilderId)
 {
     DroneType = (MyMwcObjectBuilder_Drone_TypesEnum)objectBuilderId;
 }