Пример #1
0
        public void Init(MyPrefabBase kinematicPartOwner, MyMwcObjectBuilderTypeEnum prefabKinematicPartBuilderType, int?prefabKinematicPartBuilderId, MyModelsEnum modelEnum, MyMaterialType materialType, Matrix kinematicLocalMatrix, float kinematicVelocityMax, MySoundCuesEnum?loopSound, MySoundCuesEnum?loopDamagedSound, MySoundCuesEnum?startSound, MySoundCuesEnum?endSound, float kinematicStart, float kinematicEnd)
        {
            m_needsUpdate          = true;
            m_kinematicPartOwner   = kinematicPartOwner;
            m_kinematicLocalMatrix = kinematicLocalMatrix;
            m_kinematicVelocityMax = kinematicVelocityMax;
            m_kinematicStart       = kinematicStart;
            m_kinematicEnd         = kinematicEnd;

            m_loopSoundCue        = loopSound;
            m_loopDamagedSoundCue = loopDamagedSound;
            m_startSoundCue       = startSound;
            m_endSoundCue         = endSound;

            MyMwcObjectBuilder_Base objbuilder = MyMwcObjectBuilder_Base.CreateNewObject(prefabKinematicPartBuilderType, prefabKinematicPartBuilderId);

            m_config = m_kinematicPartOwner.GetConfiguration();
            base.Init(null, modelEnum, null, kinematicPartOwner, null, objbuilder);
            LocalMatrix = Matrix.Identity;

            MaterialIndex = m_kinematicPartOwner.MaterialIndex;


            //InitTrianglePhysics(materialType, 1.0f, ModelLod0, null, MyConstants.COLLISION_LAYER_PREFAB_KINEMATIC_PART);
            InitBoxPhysics(materialType, ModelLod0, 100, 0, MyConstants.COLLISION_LAYER_PREFAB_KINEMATIC_PART, RigidBodyFlag.RBF_RBO_STATIC);
            Physics.Enabled = true;

            m_kinematicPartOwner.OnPositionChanged += OwnerPositionChanged;
        }
        public void Init(MyPrefabBase kinematicPartOwner, MyMwcObjectBuilderTypeEnum prefabKinematicPartBuilderType, int? prefabKinematicPartBuilderId, MyModelsEnum modelEnum, MyMaterialType materialType, Matrix kinematicLocalMatrix, float kinematicVelocityMax, MySoundCuesEnum? loopSound, MySoundCuesEnum? loopDamagedSound, MySoundCuesEnum? startSound, MySoundCuesEnum? endSound, float kinematicStart, float kinematicEnd) 
        {
            m_needsUpdate = true;
            m_kinematicPartOwner = kinematicPartOwner;                        
            m_kinematicLocalMatrix = kinematicLocalMatrix;
            m_kinematicVelocityMax = kinematicVelocityMax;            
            m_kinematicStart = kinematicStart;
            m_kinematicEnd = kinematicEnd;

            m_loopSoundCue = loopSound;
            m_loopDamagedSoundCue = loopDamagedSound;
            m_startSoundCue = startSound;
            m_endSoundCue = endSound;

            MyMwcObjectBuilder_Base objbuilder = MyMwcObjectBuilder_Base.CreateNewObject(prefabKinematicPartBuilderType, prefabKinematicPartBuilderId);

            m_config = m_kinematicPartOwner.GetConfiguration();
            base.Init(null, modelEnum, null, kinematicPartOwner, null, objbuilder);            
            LocalMatrix = Matrix.Identity;

            MaterialIndex = m_kinematicPartOwner.MaterialIndex;

            
            //InitTrianglePhysics(materialType, 1.0f, ModelLod0, null, MyConstants.COLLISION_LAYER_PREFAB_KINEMATIC_PART);
            InitBoxPhysics(materialType, ModelLod0, 100, 0, MyConstants.COLLISION_LAYER_PREFAB_KINEMATIC_PART, RigidBodyFlag.RBF_RBO_STATIC);
            Physics.Enabled = true;
            
            m_kinematicPartOwner.OnPositionChanged += OwnerPositionChanged;
        }
Пример #3
0
 public static void UnloadData()
 {
     m_detectedEntities.Clear();
     m_detectedFactions.Clear();
     m_lastShoutCue  = null;
     m_nextShoutTime = 0;
     StopShout();
 }
Пример #4
0
 public MyPrefabConfigurationKinematicRotating(MyModelsEnum modelBaseLod0Enum, MyModelsEnum?modelBaseLod1Enum,
                                               MySoundCuesEnum?soundOpening, MySoundCuesEnum?soundLooping,
                                               MySoundCuesEnum?soundClosing, float rotatingVelocity, BuildTypesEnum buildType, CategoryTypesEnum categoryType,
                                               SubCategoryTypesEnum?subCategoryType, MyMaterialType materialType)
     : this(modelBaseLod0Enum, modelBaseLod1Enum, soundOpening, soundLooping, soundClosing, rotatingVelocity,
            buildType, categoryType, subCategoryType, materialType, PrefabTypesFlagEnum.Default)
 {
 }
Пример #5
0
 public MyPrefabConfigurationKinematic(MyModelsEnum modelBaseLod0Enum, MyModelsEnum?modelBaseLod1Enum,
                                       List <MyPrefabConfigurationKinematicPart> kinematicParts, MySoundCuesEnum?soundOpening, MySoundCuesEnum?soundLooping,
                                       MySoundCuesEnum?soundClosing, float openTime, float closeTime, BuildTypesEnum buildType, CategoryTypesEnum categoryType,
                                       SubCategoryTypesEnum?subCategoryType, MyMaterialType materialType, MyModelsEnum?collisionModelEnum = null)
     : this(modelBaseLod0Enum, modelBaseLod1Enum, kinematicParts, soundOpening, soundLooping, soundClosing, openTime, closeTime,
            buildType, categoryType, subCategoryType, materialType, PrefabTypesFlagEnum.Default, collisionModelEnum)
 {
 }
 public MyPrefabConfigurationGenerator(MyModelsEnum modelLod0Enum, MyModelsEnum?modelLod1Enum, BuildTypesEnum buildType, CategoryTypesEnum categoryType,
                                       SubCategoryTypesEnum?subCategoryType, MyMaterialType materialType, PrefabTypesFlagEnum prefabTypeFlag, float range, float rotatingVelocity = DEFAULT_ROTATING_VELOCITY,
                                       MySoundCuesEnum?startRotatingCue   = MySoundCuesEnum.Amb3D_GenXstart, MySoundCuesEnum?looptRotatingCue = MySoundCuesEnum.Amb3D_GenXloop, MySoundCuesEnum?endRotatingCue = MySoundCuesEnum.Amb3D_GenXend, MyModelsEnum?modelCol = null,
                                       float explosionParticleEffectScale = 1)
     : base(modelLod0Enum, modelLod1Enum, buildType, categoryType, subCategoryType, materialType, prefabTypeFlag, minElectricCapacity : MyGameplayConstants.DEFAULT_MAX_ELECTRIC_CAPACITY, rotatingVelocity : rotatingVelocity, collisionModelEnum : modelCol,
            startRotatingCue : startRotatingCue, loopRotatingCue : looptRotatingCue, endRotatingCue : endRotatingCue, displayHud : true, explosionParticleEffectScale : explosionParticleEffectScale)
 {
     Range = range;
 }
        /// <summary>
        /// Creates new instance of prefab configuration without model
        /// </summary>
        /// <param name="buildType">Build type</param>
        /// <param name="categoryType">Category type</param>
        /// <param name="subCategoryType">Subcategory type</param>
        /// <param name="materialType">Material type</param>
        /// <param name="prefabTypeFlag">Prefab type flags</param>
        /// <param name="factionSpecific">To which faction is this prefab specific. Null if prefab is for all factions. Used for material (texture) set availability. </param>
        /// <param name="previewPointOfView">Indicates whether the preview image for this prefab should be from a different angle than normal. Use for flat objects that have incorrect default previews (such as signs). </param>
        protected MyPrefabConfiguration(
            BuildTypesEnum buildType,
            CategoryTypesEnum categoryType,
            SubCategoryTypesEnum? subCategoryType,
            MyMaterialType materialType,
            PrefabTypesFlagEnum prefabTypeFlag,
            MyMwcObjectBuilder_Prefab_AppearanceEnum? factionSpecific = null,
            bool needsUpdate = false,
            bool initPhysics = true,
            bool enabledInEditor = true,
            float rotatingVelocity = DEFAULT_ROTATING_VELOCITY,
            MySoundCuesEnum? startRotatingCue = null,
            MySoundCuesEnum? loopRotatingCue = null,
            MySoundCuesEnum? loopRotatingDamagedCue = null,
            MySoundCuesEnum? endRotatingCue = null,
            MyPreviewPointOfViewEnum previewPointOfView = MyPreviewPointOfViewEnum.Front,
            float minElectricCapacity = MyGameplayConstants.DEFAULT_MIN_ELECTRIC_CAPACITY,
            float maxElectricCapacity = MyGameplayConstants.DEFAULT_MAX_ELECTRIC_CAPACITY,
            MyExplosionTypeEnum explosionType = MyExplosionTypeEnum.SMALL_SHIP_EXPLOSION,
            float explosionRadiusMultiplier = 1.5f,
            float explosionDamageMultiplier = 1,
            float minSizeForExplosion = MyExplosionsConstants.MIN_OBJECT_SIZE_TO_CAUSE_EXPLOSION_AND_CREATE_DEBRIS,
            bool causesAlarm = false,
            bool requiresEnergy = false,
            float explosionParticleEffectScale = 1,
            bool displayHud = false)
        {
            //m_modelLod0Enum = null;
            m_modelLod1Enum = null;

            BuildType = buildType;
            CategoryType = categoryType;
            SubCategoryType = subCategoryType;
            MaterialType = materialType;
            PrefabTypeFlag = prefabTypeFlag;
            FactionSpecific = factionSpecific;
            EnabledInEditor = enabledInEditor;
            RotatingVelocity = rotatingVelocity;
            StartRotatingCue = startRotatingCue;
            LoopRotatingCue = loopRotatingCue;
            LoopRotatingDamagedCue = loopRotatingDamagedCue;
            EndRotatingCue = endRotatingCue;
            PreviewPointOfView = new MyPreviewPointOfView(previewPointOfView);
            MinElectricCapacity = minElectricCapacity;
            MaxElectricCapacity = maxElectricCapacity;
            NeedsUpdate = needsUpdate;
            InitPhysics = initPhysics;
            ExplosionType = explosionType;
            ExplosionRadiusMultiplier = explosionRadiusMultiplier;
            ExplosionDamage = explosionDamageMultiplier;
            ExplosionParticleEffectScale = explosionParticleEffectScale;
            MinSizeForExplosion = minSizeForExplosion;
            CausesAlarm = causesAlarm;
            RequiresEnergy = requiresEnergy;
            DisplayHud = displayHud;
        }
 public MyPrefabConfigurationKinematicRotating(MyModelsEnum modelBaseLod0Enum, MyModelsEnum? modelBaseLod1Enum, 
         MySoundCuesEnum? soundOpening, MySoundCuesEnum? soundLooping, 
         MySoundCuesEnum? soundClosing, float rotatingVelocity, BuildTypesEnum buildType, CategoryTypesEnum categoryType,
         SubCategoryTypesEnum? subCategoryType, MyMaterialType materialType, PrefabTypesFlagEnum prefabTypeFlag)
     : base(modelBaseLod0Enum, modelBaseLod1Enum, buildType, categoryType, subCategoryType, materialType, prefabTypeFlag)
 {
     SoundOpening = soundOpening;
     SoundLooping = soundLooping;
     SoundClosing = soundClosing;
     RotatingVelocity = rotatingVelocity;
 }
Пример #9
0
 public MyPrefabConfigurationKinematicRotating(MyModelsEnum modelBaseLod0Enum, MyModelsEnum?modelBaseLod1Enum,
                                               MySoundCuesEnum?soundOpening, MySoundCuesEnum?soundLooping,
                                               MySoundCuesEnum?soundClosing, float rotatingVelocity, BuildTypesEnum buildType, CategoryTypesEnum categoryType,
                                               SubCategoryTypesEnum?subCategoryType, MyMaterialType materialType, PrefabTypesFlagEnum prefabTypeFlag)
     : base(modelBaseLod0Enum, modelBaseLod1Enum, buildType, categoryType, subCategoryType, materialType, prefabTypeFlag)
 {
     SoundOpening     = soundOpening;
     SoundLooping     = soundLooping;
     SoundClosing     = soundClosing;
     RotatingVelocity = rotatingVelocity;
 }
        public void Init(MyPrefabKinematic owner, MyPrefabConfigurationKinematicPart config, float openTime, float closeTime, MyModelsEnum modelEnum, Matrix open, Matrix close, MyMaterialType matType, MySoundCuesEnum?loopSound, MySoundCuesEnum?startSound, MySoundCuesEnum?endSound /*, MyGroupMask grpMask*/, float?health, float?maxHealth, bool activated)
        {
            m_needsUpdate = config.NeedsUpdate;
            m_openTime    = openTime * 1000;
            m_closeTime   = closeTime * 1000;
            m_radialState = MAX_RADIAL_STATE;// 0;
            m_config      = config;

            m_loopSoundCue  = loopSound;
            m_startSoundCue = startSound;
            m_endSoundCue   = endSound;

            m_openLocalPosition = open.Translation - close.Translation;

            m_looping = false;

            m_ownerKinematic = owner;
            m_lastUpdateTime = 0;

            MyMwcObjectBuilder_Base objbuilder = MyMwcObjectBuilder_Base.CreateNewObject(MyMwcObjectBuilderTypeEnum.PrefabKinematicPart, config.PrefabId);

            objbuilder.EntityId = MyEntityIdentifier.ToNullableInt(EntityId);

            StringBuilder hudLabelTextSb = null;

            base.Init(hudLabelTextSb, modelEnum, null, owner, null, objbuilder);
            if (maxHealth != null)
            {
                MaxHealth = maxHealth.Value;
            }
            if (health != null)
            {
                Health = health.Value;
            }

            //LocalMatrix = Matrix.Invert(MyMath.NormalizeMatrix(close));
            LocalMatrix = Matrix.CreateTranslation(Vector3.Zero);

            InitTrianglePhysics(matType, 1.0f, ModelLod0, null, MyConstants.COLLISION_LAYER_PREFAB_KINEMATIC_PART);

            SetState(KinematicPrefabStateEnum.Sleeping);

            if (activated)
            {
                PersistentFlags &= ~MyPersistentEntityFlags.Deactivated;
            }
            else
            {
                PersistentFlags |= MyPersistentEntityFlags.Deactivated;
            }
            //StartClosing();
        }
Пример #11
0
 public MyPrefabConfigurationKinematic(MyModelsEnum modelBaseLod0Enum, MyModelsEnum?modelBaseLod1Enum,
                                       List <MyPrefabConfigurationKinematicPart> kinematicParts, MySoundCuesEnum?soundOpening, MySoundCuesEnum?soundLooping,
                                       MySoundCuesEnum?soundClosing, float openTime, float closeTime, BuildTypesEnum buildType, CategoryTypesEnum categoryType,
                                       SubCategoryTypesEnum?subCategoryType, MyMaterialType materialType, PrefabTypesFlagEnum prefabTypeFlag, MyModelsEnum?collisionModelEnum = null)
     : base(modelBaseLod0Enum, modelBaseLod1Enum, buildType, categoryType, subCategoryType, materialType, prefabTypeFlag, collisionModelEnum: collisionModelEnum, displayHud: true)
 {
     m_openTime     = openTime;
     m_closeTime    = closeTime;
     KinematicParts = kinematicParts;
     m_soundOpening = soundOpening;
     m_soundLooping = soundLooping;
     m_soundClosing = soundClosing;
 }
 public MyPrefabConfigurationKinematic(MyModelsEnum modelBaseLod0Enum, MyModelsEnum? modelBaseLod1Enum, 
         List<MyPrefabConfigurationKinematicPart> kinematicParts, MySoundCuesEnum? soundOpening, MySoundCuesEnum? soundLooping, 
         MySoundCuesEnum? soundClosing, float openTime, float closeTime, BuildTypesEnum buildType, CategoryTypesEnum categoryType,
         SubCategoryTypesEnum? subCategoryType, MyMaterialType materialType, PrefabTypesFlagEnum prefabTypeFlag, MyModelsEnum? collisionModelEnum = null)
     : base(modelBaseLod0Enum, modelBaseLod1Enum, buildType, categoryType, subCategoryType, materialType, prefabTypeFlag, collisionModelEnum: collisionModelEnum, displayHud: true)
 {
     m_openTime = openTime;
     m_closeTime = closeTime;
     KinematicParts = kinematicParts;
     m_soundOpening = soundOpening;
     m_soundLooping = soundLooping;
     m_soundClosing = soundClosing;
 }
Пример #13
0
        public MyDialogueSentence(MyActorEnum speaker, MySoundCuesEnum?cue, MyDialoguesWrapperEnum text, float noise = 0.0f, float pauseBefore_ms = 0.0f, MyActorEnum?listener = null)
        {
            Actor          = speaker;
            Listener       = listener;
            Cue            = cue;
            Text           = text;
            PauseBefore_ms = pauseBefore_ms;

            SentenceTime_ms = MathHelper.Clamp(MyDialoguesWrapper.Get(Text).Length * 66, MIN_SENTENCE_TIME, MAX_SENTENCE_TIME) + PauseBefore_ms;
            MyCommonDebugUtils.AssertDebug(noise >= 0 && noise <= 1, "Bad dialogue sentence noise value!");
            Noise = noise;

            if (MyActorConstants.IsNoiseActor(speaker))
            {
                Noise = 1f;
            }
        }
Пример #14
0
        MySoundCuesEnum GetCueEnumByExplosionType(MyExplosionTypeEnum explosionType)
        {
            MySoundCuesEnum?cueEnum = null;

            switch (explosionType)
            {
            case MyExplosionTypeEnum.MISSILE_EXPLOSION:
                cueEnum = MySoundCuesEnum.WepMissileExplosion;
                break;

            case MyExplosionTypeEnum.SMALL_SHIP_EXPLOSION:
                cueEnum = MySoundCuesEnum.SfxShipSmallExplosion;
                break;

            case MyExplosionTypeEnum.BOMB_EXPLOSION:
                cueEnum = MySoundCuesEnum.WepBombExplosion;
                break;

            case MyExplosionTypeEnum.METEOR_EXPLOSION:
                cueEnum = MySoundCuesEnum.SfxMeteorExplosion;
                break;

            case MyExplosionTypeEnum.FLASH_EXPLOSION:
                cueEnum = MySoundCuesEnum.WepBombFlash;
                break;

            case MyExplosionTypeEnum.GRAVITY_EXPLOSION:
                cueEnum = MySoundCuesEnum.WepBombGravSuck;
                break;

            case MyExplosionTypeEnum.EMP_EXPLOSION:
                cueEnum = MySoundCuesEnum.WepEpmExplosion;
                break;

            case MyExplosionTypeEnum.LARGE_SHIP_EXPLOSION:
                cueEnum = MySoundCuesEnum.SfxShipLargeExplosion;
                break;

            default:
                cueEnum = MySoundCuesEnum.WepMissileExplosion;
                break;
            }

            return(cueEnum.Value);
        }
Пример #15
0
        public void StopLoopSound()
        {
            MySoundCue?weaponCue = GetWeaponCue(m_cueEnum);

            if ((weaponCue != null) && weaponCue.Value.IsValid && (weaponCue.Value.IsPlaying == true))
            {
                MySoundCuesEnum?cueEnum = null;
                if (m_cueEnum == MySoundCuesEnum.WepMachineGunHighFire3d)
                {
                    cueEnum = MySoundCuesEnum.WepMachineGunHighRel3d;
                }
                else
                {
                    cueEnum = MySoundCuesEnum.WepMachineGunNormRel3d;
                }
                weaponCue.Value.Stop(SharpDX.XACT3.StopFlags.Immediate);
                AddWeaponCue(cueEnum.Value);
            }
        }
Пример #16
0
        private static void UpdateShouts()
        {
            // check for new shout to start
            if (m_actualShoutCue == null || !m_actualShoutCue.Value.IsPlaying)
            {
                // check if we can start new shout
                if (m_nextShoutTime < MyMinerGame.TotalGamePlayTimeInMilliseconds)
                {
                    // gets random faction to shout (from detected factions by radar)
                    MyMwcObjectBuilder_FactionEnum?factionToShout = GetRandomDetectedFaction();
                    if (factionToShout != null)
                    {
                        MySoundCuesEnum shoutCue = GetRandomShout(factionToShout.Value);
                        m_actualShoutCue = MyAudio.AddCue2D(shoutCue);
                        if (m_actualShoutCue != null)
                        {
                            // because shouts can be ambient cues, so we must set correct volume for these cues
                            if (m_actualShoutCue.Value.IsAmbientSound)
                            {
                                MyAudio.UpdateCueAmbVolume(m_actualShoutCue, 100f);
                            }
                            else
                            {
                                MyAudio.UpdateCueVolume(m_actualShoutCue, 0.9f);
                            }
                            m_actualShoutFaction = factionToShout;
                            m_lastShoutCue       = shoutCue;

                            // calculate new time for next shout
                            m_nextShoutTime = MyMinerGame.TotalGamePlayTimeInMilliseconds + MyMwcUtils.GetRandomInt(INTERVAL_BETWEEN_SHOUTS_MIN, INTERVAL_BETWEEN_SHOUTS_MAX);
                        }
                    }
                }
            }
            // check for old shout to stop
            else
            {
                if (!m_detectedFactions.Contains(m_actualShoutFaction.Value))
                {
                    StopShout();
                }
            }
        }
        public MyGuiScreenSimpleProgressBar(MyTextsWrapperEnum caption, StringBuilder text, float value, MySoundCuesEnum? progressCueEnum, MySoundCuesEnum? cancelCueEnum, int decimals, MySoundCuesEnum? successCueEnum = null) 
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(0.4f, 0.4f))
        {
            m_decimals = decimals;
            m_text = text;
            m_closeOnEsc = false;
            m_isTopMostScreen = true;            
            m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\ProgressBarBackground", flags: TextureFlags.IgnoreQuality);
            m_size = new Vector2(673/1600f, 363/1200f);// MyGuiManager.GetNormalizedCoordsAndPreserveOriginalSize(673, 363);

            m_progressCueEnum = progressCueEnum;
            m_cancelCueEnum = cancelCueEnum;
            m_successCueEnum = successCueEnum;

            AddCaption(caption, new Vector2(0f, 0.015f));
            Vector2 progressBarSize = new Vector2(559 / 1600f, 112 / 1200f);// MyGuiManager.GetNormalizedCoordsAndPreserveOriginalSize(559, 112);            
            m_progressBar = new MyGuiControlProgressBar(this, Vector2.Zero, progressBarSize, Vector4.Zero, new Vector4(1f, 1f, 1f, 1f), Color.White.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE, value, m_decimals);
            Controls.Add(m_progressBar);

            m_progressText = new MyGuiControlLabel(this, new Vector2(0f, 0.05f), null, m_text, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            Controls.Add(m_progressText);
        }
Пример #18
0
        public MyGuiScreenSimpleProgressBar(MyTextsWrapperEnum caption, StringBuilder text, float value, MySoundCuesEnum?progressCueEnum, MySoundCuesEnum?cancelCueEnum, int decimals, MySoundCuesEnum?successCueEnum = null)
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(0.4f, 0.4f))
        {
            m_decimals          = decimals;
            m_text              = text;
            m_closeOnEsc        = false;
            m_isTopMostScreen   = true;
            m_backgroundTexture = MyTextureManager.GetTexture <MyTexture2D>("Textures\\GUI\\BackgroundScreen\\ProgressBarBackground", flags: TextureFlags.IgnoreQuality);
            m_size              = new Vector2(673 / 1600f, 363 / 1200f);// MyGuiManager.GetNormalizedCoordsAndPreserveOriginalSize(673, 363);

            m_progressCueEnum = progressCueEnum;
            m_cancelCueEnum   = cancelCueEnum;
            m_successCueEnum  = successCueEnum;

            AddCaption(caption, new Vector2(0f, 0.015f));
            Vector2 progressBarSize = new Vector2(559 / 1600f, 112 / 1200f);// MyGuiManager.GetNormalizedCoordsAndPreserveOriginalSize(559, 112);

            m_progressBar = new MyGuiControlProgressBar(this, Vector2.Zero, progressBarSize, Vector4.Zero, new Vector4(1f, 1f, 1f, 1f), Color.White.ToVector4(), MyGuiConstants.LABEL_TEXT_SCALE, value, m_decimals);
            Controls.Add(m_progressBar);

            m_progressText = new MyGuiControlLabel(this, new Vector2(0f, 0.05f), null, m_text, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            Controls.Add(m_progressText);
        }
 /// <summary>
 /// Creates new instance of prefab configuration with default prefab type flags
 /// </summary>
 /// <param name="modelLod0Enum">Model LOD0</param>
 /// <param name="modelLod1Enum">Model LOD2</param>
 /// <param name="buildType">Build type</param>
 /// <param name="categoryType">Category type</param>
 /// <param name="subCategoryType">Subcategory type</param>
 /// <param name="materialType">Material type</param>
 /// <param name="factionSpecific">To which faction is this prefab specific. Null if prefab is for all factions. Used for material (texture) set availability. </param>     
 public MyPrefabConfiguration(
     MyModelsEnum modelLod0Enum,
     MyModelsEnum? modelLod1Enum,
     BuildTypesEnum buildType,
     CategoryTypesEnum categoryType,
     SubCategoryTypesEnum? subCategoryType,
     MyMaterialType materialType,
     MyMwcObjectBuilder_Prefab_AppearanceEnum? factionSpecific = null,
     MyModelsEnum? collisionModelEnum = null,
     bool needsUpdate = false,
     bool initPhysics = true,
     bool enabledInEditor = true,
     float rotatingVelocity = DEFAULT_ROTATING_VELOCITY,
     MySoundCuesEnum? startRotatingCue = null,
     MySoundCuesEnum? loopRotatingCue = null,
     MySoundCuesEnum? loopRotatingDamagedCue = null,
     MySoundCuesEnum? endRotatingCue = null,
     MyPreviewPointOfViewEnum previewAngle = MyPreviewPointOfViewEnum.Front,
     MyExplosionTypeEnum explosionType = MyExplosionTypeEnum.SMALL_SHIP_EXPLOSION,
     float explosionRadiusMultiplier = 1,
     float explosionDamageMultiplier = 1,
     float minSizeForExplosion = MyExplosionsConstants.MIN_OBJECT_SIZE_TO_CAUSE_EXPLOSION_AND_CREATE_DEBRIS,
     bool causesAlarm = false,
     bool requiresEnergy = false,
     float explosionParticleEffectScale = 1,
     bool displayHud = false)
     : this(modelLod0Enum, modelLod1Enum, buildType, categoryType, subCategoryType, materialType, PrefabTypesFlagEnum.Default, collisionModelEnum, factionSpecific, needsUpdate, initPhysics, enabledInEditor, rotatingVelocity,
     startRotatingCue, loopRotatingCue, loopRotatingDamagedCue, endRotatingCue,
     previewAngle, explosionType: explosionType, explosionRadiusMultiplier: explosionRadiusMultiplier, explosionDamage: explosionDamageMultiplier, minSizeForExplosion: minSizeForExplosion, causesAlarm: causesAlarm, requiresEnergy: requiresEnergy, explosionParticleEffectScale: explosionParticleEffectScale, displayHud: displayHud)
 {
     System.Diagnostics.Debug.Assert(modelLod0Enum != modelLod1Enum, "LOD0 and LOD1 models are the same!");
     if (collisionModelEnum != null)
     {
         System.Diagnostics.Debug.Assert(modelLod0Enum != collisionModelEnum, "LOD0 and COL models are the same!");
         System.Diagnostics.Debug.Assert(modelLod1Enum != collisionModelEnum, "LOD1 and COL models are the same!");
     }
 }
 /// <summary>
 /// Creates new instance of prefab configuration
 /// </summary>
 /// <param name="modelLod0Enum">Model LOD0</param>
 /// <param name="modelLod1Enum">Model LOD2</param>
 /// <param name="buildType">Build type</param>
 /// <param name="categoryType">Category type</param>
 /// <param name="subCategoryType">Subcategory type</param>
 /// <param name="materialType">Material type</param>
 /// <param name="prefabTypeFlag">Prefab type flags</param>
 protected MyPrefabConfiguration(
     MyModelsEnum modelLod0Enum,
     MyModelsEnum? modelLod1Enum,
     BuildTypesEnum buildType,
     CategoryTypesEnum categoryType,
     SubCategoryTypesEnum? subCategoryType,
     MyMaterialType materialType,
     PrefabTypesFlagEnum prefabTypeFlag,
     MyModelsEnum? collisionModelEnum = null,
     MyMwcObjectBuilder_Prefab_AppearanceEnum? factionSpecific = null,
     bool needsUpdate = false,
     bool initPhysics = true,
     bool enabledInEditor = true,
     float rotatingVelocity = DEFAULT_ROTATING_VELOCITY,
     MySoundCuesEnum? startRotatingCue = null,
     MySoundCuesEnum? loopRotatingCue = null,
     MySoundCuesEnum? loopRotatingDamagedCue = null,
     MySoundCuesEnum? endRotatingCue = null,
     MyPreviewPointOfViewEnum previewAngle = MyPreviewPointOfViewEnum.Front,
     float minElectricCapacity = MyGameplayConstants.DEFAULT_MIN_ELECTRIC_CAPACITY,
     float maxElectricCapacity = MyGameplayConstants.DEFAULT_MAX_ELECTRIC_CAPACITY,
     MyExplosionTypeEnum explosionType = MyExplosionTypeEnum.SMALL_SHIP_EXPLOSION,
     float explosionRadiusMultiplier = 1,
     float explosionDamage = 1,
     float minSizeForExplosion = MyExplosionsConstants.MIN_OBJECT_SIZE_TO_CAUSE_EXPLOSION_AND_CREATE_DEBRIS,
     bool causesAlarm = false,
     bool requiresEnergy = false,
     float explosionParticleEffectScale = 1,
     bool displayHud = false)
     : this(buildType, categoryType, subCategoryType, materialType, prefabTypeFlag, factionSpecific, needsUpdate, initPhysics, enabledInEditor, rotatingVelocity, 
     startRotatingCue, loopRotatingCue, loopRotatingDamagedCue, endRotatingCue,
     previewAngle, minElectricCapacity, maxElectricCapacity, explosionType, explosionRadiusMultiplier, explosionDamage, minSizeForExplosion, causesAlarm, requiresEnergy: requiresEnergy, explosionParticleEffectScale: explosionParticleEffectScale, displayHud: displayHud)
 {
     m_modelLod0Enum = modelLod0Enum;
     m_modelLod1Enum = modelLod1Enum;
     m_collisionModelEnum = collisionModelEnum;
 }
Пример #21
0
        void PlayLoopSound(ref MySoundCue?sound, MySoundCuesEnum?soundCue)
        {
            if (soundCue != null)
            {
                if (m_starting && sound.HasValue && sound.Value.IsPlaying)
                {
                    m_starting = false;
                    m_playing  = true;
                }
                if (sound == null || (m_playing && !sound.Value.IsPlaying))
                {
                    m_playing = false;

                    sound = MyAudio.AddCue3D(
                        soundCue.Value,
                        m_kinematicPartOwner.WorldMatrix.Translation,
                        Vector3.Forward,
                        Vector3.Forward,
                        Vector3.Zero);

                    m_starting = sound != null;
                }
            }
        }
Пример #22
0
 public void Init(MyPrefabBase rotatingOwner, MyModelsEnum modelEnum, MyMaterialType matType, Matrix rotatingLocal, float rotatingVelocityMax, MySoundCuesEnum?loopSound, MySoundCuesEnum?loopDamagedSound, MySoundCuesEnum?startSound, MySoundCuesEnum?endSound, Vector3 rotationVector, bool activated)
 {
     m_rotationVector = rotationVector;
     base.Init(rotatingOwner, MyMwcObjectBuilderTypeEnum.PrefabKinematicRotatingPart, (int)MyMwcObjectBuilder_PrefabKinematicRotatingPart_TypesEnum.DEFAULT,
               modelEnum, matType, rotatingLocal, rotatingVelocityMax, loopSound, loopDamagedSound, startSound, endSound, 1f, 1f);
     if (activated)
     {
         PersistentFlags &= ~MyPersistentEntityFlags.Deactivated;
     }
     else
     {
         PersistentFlags |= MyPersistentEntityFlags.Deactivated;
     }
 }
Пример #23
0
 public MyHackingResultMessage(MyTextsWrapperEnum? text, GetFontDelegate getFontDelegate, MySoundCuesEnum? soundCue)
 {
     Text = text;
     GetFontDelegate = getFontDelegate;
     SoundCue = soundCue;
 }
Пример #24
0
 public static void UnloadData() 
 {
     m_detectedEntities.Clear();
     m_detectedFactions.Clear();
     m_lastShoutCue = null;
     m_nextShoutTime = 0;
     StopShout();
 }
Пример #25
0
        private static void UpdateShouts() 
        {
            // check for new shout to start
            if (m_actualShoutCue == null || !m_actualShoutCue.Value.IsPlaying)
            {
                // check if we can start new shout
                if (m_nextShoutTime < MyMinerGame.TotalGamePlayTimeInMilliseconds)
                {
                    // gets random faction to shout (from detected factions by radar)
                    MyMwcObjectBuilder_FactionEnum? factionToShout = GetRandomDetectedFaction();
                    if (factionToShout != null)
                    {
                        MySoundCuesEnum shoutCue = GetRandomShout(factionToShout.Value);
                        m_actualShoutCue = MyAudio.AddCue2D(shoutCue);
                        if (m_actualShoutCue != null)
                        {
                            // because shouts can be ambient cues, so we must set correct volume for these cues
                            if (m_actualShoutCue.Value.IsAmbientSound)
                            {
                                MyAudio.UpdateCueAmbVolume(m_actualShoutCue, 100f);
                            }
                            else 
                            {
                                MyAudio.UpdateCueVolume(m_actualShoutCue, 0.9f);
                            }
                            m_actualShoutFaction = factionToShout;
                            m_lastShoutCue = shoutCue;

                            // calculate new time for next shout
                            m_nextShoutTime = MyMinerGame.TotalGamePlayTimeInMilliseconds + MyMwcUtils.GetRandomInt(INTERVAL_BETWEEN_SHOUTS_MIN, INTERVAL_BETWEEN_SHOUTS_MAX);                            
                        }
                    }
                }
            }
            // check for old shout to stop
            else 
            {
                if (!m_detectedFactions.Contains(m_actualShoutFaction.Value))
                {
                    StopShout();
                }
            }
        }
Пример #26
0
 public MyHackingResultMessage(MyTextsWrapperEnum?text, GetFontDelegate getFontDelegate, MySoundCuesEnum?soundCue)
 {
     Text            = text;
     GetFontDelegate = getFontDelegate;
     SoundCue        = soundCue;
 }
Пример #27
0
 public MyCueParameters(bool useOcclusion, MySoundCuesEnum? wrapped2dEnum, bool loopable, bool isHudCue)
 {
     UseOcclusion = useOcclusion;
     LastUpdate = 0;
     Wrapped2dEnum = wrapped2dEnum;
     Loopable = loopable;
     MaxDistance = MyFakes.USE_LONG_SOUND_DISTANCE ? MyFakes.LONG_SOUND_DISTANCE : MyAudio.DISTANCE_1000_METERS;  //  Default distance
     IsHudCue = isHudCue;
 }
Пример #28
0
        public MyGuiScreenUseProgressBar(MyTextsWrapperEnum caption, StringBuilder text, float value, MySoundCuesEnum?progressCueEnum, MySoundCuesEnum?cancelCueEnum, MyGameControlEnums gameControl, int closeTime, int successTime, int decimals, MySoundCuesEnum?successCueEnum = null)
            : base(caption, text, value, progressCueEnum, cancelCueEnum, decimals, successCueEnum)
        {
            DrawMouseCursor = false;

            m_gameControl = gameControl;
            m_closeTime   = closeTime;
            m_successTime = successTime;
            //m_startedTime = MyMinerGame.TotalGamePlayTimeInMilliseconds;
        }
Пример #29
0
 public MyGuiScreenUseProgressBar(MyTextsWrapperEnum caption, MyTextsWrapperEnum text, float value, MySoundCuesEnum?progressCueEnum, MySoundCuesEnum?cancelCueEnum, MyGameControlEnums gameControl, int closeTime, int successTime, int decimals, MySoundCuesEnum?successCueEnum = null)
     : this(caption, MyTextsWrapper.Get(text), value, progressCueEnum, cancelCueEnum, gameControl, closeTime, successTime, decimals, successCueEnum)
 {
 }
Пример #30
0
 public MyGuiScreenSimpleProgressBar(MyTextsWrapperEnum caption, MyTextsWrapperEnum text, float value, MySoundCuesEnum?progressCueEnum, MySoundCuesEnum?cancelCueEnum, int decimals, MySoundCuesEnum?successCueEnum = null)
     : this(caption, MyTextsWrapper.Get(text), value, progressCueEnum, cancelCueEnum, decimals, successCueEnum)
 {
 }
Пример #31
0
 public static void AddCollisionCue(MyMaterialCollisionType type, MyMaterialType materialType1, MyMaterialType materialType2, MySoundCuesEnum?cue)
 {
     CollisionCues[(int)type, (int)materialType1, (int)materialType2] = cue;
     CollisionCues[(int)type, (int)materialType2, (int)materialType1] = cue;
 }