Ejemplo n.º 1
0
 public MySoundCue(MyCueProxy cue, MySoundCuesEnum cueEnum, bool apply3d)
 {
     m_cue = cue;
     m_version = cue.Version;
     m_cueEnum = cueEnum;
     m_apply3d = apply3d;
 }
        private void InitSounds(MyUseObjectiveType objectiveType)
        {
            switch (objectiveType)
            {
            case MyUseObjectiveType.Activating:
                m_progressCue = MySoundCuesEnum.SfxProgressActivation;
                m_cancelCue   = MySoundCuesEnum.SfxCancelActivation;
                break;

            case MyUseObjectiveType.Building:
                m_progressCue = MySoundCuesEnum.SfxProgressBuild;
                m_cancelCue   = MySoundCuesEnum.SfxCancelBuild;
                break;

            case MyUseObjectiveType.Hacking:
                m_progressCue = MySoundCuesEnum.SfxProgressHack;
                m_cancelCue   = MySoundCuesEnum.SfxCancelHack;
                break;

            case MyUseObjectiveType.Repairing:
                m_progressCue = MySoundCuesEnum.SfxProgressRepair;
                m_cancelCue   = MySoundCuesEnum.SfxCancelRepair;
                break;

            case MyUseObjectiveType.Taking:
                m_progressCue = MySoundCuesEnum.SfxProgressTake;
                m_cancelCue   = MySoundCuesEnum.SfxCancelTake;
                break;

            case MyUseObjectiveType.Putting:
                m_progressCue = MySoundCuesEnum.SfxProgressPut;
                m_cancelCue   = MySoundCuesEnum.SfxCancelPut;
                break;
            }
        }
 private void InitSounds(MyUseObjectiveType objectiveType)
 {
     switch (objectiveType)
     {
         case MyUseObjectiveType.Activating:
             m_progressCue = MySoundCuesEnum.SfxProgressActivation;
             m_cancelCue = MySoundCuesEnum.SfxCancelActivation;
             break;
         case MyUseObjectiveType.Building:
             m_progressCue = MySoundCuesEnum.SfxProgressBuild;
             m_cancelCue = MySoundCuesEnum.SfxCancelBuild;
             break;
         case MyUseObjectiveType.Hacking:
             m_progressCue = MySoundCuesEnum.SfxProgressHack;
             m_cancelCue = MySoundCuesEnum.SfxCancelHack;
             break;
         case MyUseObjectiveType.Repairing:
             m_progressCue = MySoundCuesEnum.SfxProgressRepair;
             m_cancelCue = MySoundCuesEnum.SfxCancelRepair;
             break;
         case MyUseObjectiveType.Taking:
             m_progressCue = MySoundCuesEnum.SfxProgressTake;
             m_cancelCue = MySoundCuesEnum.SfxCancelTake;
             break;
         case MyUseObjectiveType.Putting:
             m_progressCue = MySoundCuesEnum.SfxProgressPut;
             m_cancelCue = MySoundCuesEnum.SfxCancelPut;
             break;
     }
 }
Ejemplo n.º 4
0
 public MySoundCue(MyCueProxy cue, MySoundCuesEnum cueEnum, bool apply3d)
 {
     m_cue     = cue;
     m_version = cue.Version;
     m_cueEnum = cueEnum;
     m_apply3d = apply3d;
 }
Ejemplo n.º 5
0
 public void SubmitSourceBuffer(MySoundCuesEnum cueEnum, AudioBuffer buffer, uint[] decodedXMWAPacketInfo, int sampleRate)
 {
     m_cueEnum                = cueEnum;
     m_isLoopable             = (buffer.LoopCount > 0);
     m_voice.SourceSampleRate = sampleRate;
     m_voice.SubmitSourceBuffer(buffer, decodedXMWAPacketInfo);
 }
 public void SubmitSourceBuffer(MySoundCuesEnum cueEnum, AudioBuffer buffer, uint[] decodedXMWAPacketInfo, int sampleRate)
 {
     m_cueEnum = cueEnum;
     m_isLoopable = (buffer.LoopCount > 0);
     m_voice.SourceSampleRate = sampleRate;
     m_voice.SubmitSourceBuffer(buffer, decodedXMWAPacketInfo);
 }
        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;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Called when user presses ESC or clicks on CANCEL - hook to this method so you can do gui-screen-specific event
        /// </summary>
        protected virtual void Canceling()
        {
            Canceled = true;
            MySoundCuesEnum cancelEnum = m_closingCueEnum.HasValue ? m_closingCueEnum.Value : MySoundCuesEnum.GuiMouseClick;

            MyAudio.AddCue2D(cancelEnum);
            CloseScreen();
        }
 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)
 {
 }    
 public static MyGuiInfluenceSphereHelper GetInfluenceSphereSoundHelper(MySoundCuesEnum soundEnum)
 {
     MyGuiInfluenceSphereHelper ret;
     if (m_influenceSphereSoundHelpers.TryGetValue((short)soundEnum, out ret))
         return ret;
     else
         return null;
 }
 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)
 {
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Creates new instance of MyHudSoundWaring, with repeating
 /// </summary>
 /// <param name="sound">Sound to play</param>
 /// <param name="repeatInverval">Repeat sound in interval (in ms) ... for non repeat set to 0</param>
 /// <param name="initialDelay">Waiting time (in ms) before the sound plays when the condition is encountered</param>
 public MyHudSoundWarning(MySoundCuesEnum sound, int repeatInverval, int initialDelay = 0, bool playOverDialogues = true)
 {
     Sound = sound;
     RepeatInterval = repeatInverval;
     m_msSinceLastStateChange = 0;
     m_warningState = WarningState.NOT_STARTED;
     m_initialDelay = initialDelay;
     m_playOverDialogues = playOverDialogues;
 }
Ejemplo n.º 13
0
        private static void AddActorsShouts(MyMwcObjectBuilder_FactionEnum faction, MySoundCuesEnum shoutCue)
        {
            if (!m_shouts.ContainsKey((int)faction))
            {
                m_shouts.Add((int)faction, new List <MySoundCuesEnum>());
            }

            m_shouts[(int)faction].Add(shoutCue);
        }
 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;
 }
Ejemplo n.º 15
0
        public void SendPlaySound(Vector3?position, MySoundCuesEnum id)
        {
            var msg = new MyEventPlaySound();

            msg.Position  = position;
            msg.SoundEnum = (int)id;

            Peers.SendToAll(ref msg, NetDeliveryMethod.ReliableOrdered);
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Creates new instance of MyHudSoundWaring, with repeating
 /// </summary>
 /// <param name="sound">Sound to play</param>
 /// <param name="repeatInverval">Repeat sound in interval (in ms) ... for non repeat set to 0</param>
 /// <param name="initialDelay">Waiting time (in ms) before the sound plays when the condition is encountered</param>
 public MyHudSoundWarning(MySoundCuesEnum sound, int repeatInverval, int initialDelay = 0, bool playOverDialogues = true)
 {
     Sound                    = sound;
     RepeatInterval           = repeatInverval;
     m_msSinceLastStateChange = 0;
     m_warningState           = WarningState.NOT_STARTED;
     m_initialDelay           = initialDelay;
     m_playOverDialogues      = playOverDialogues;
 }
        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;
        }        
Ejemplo n.º 18
0
        public void StartLoopSound(MySoundCuesEnum cueEnum)
        {
            MySoundCue?weaponCue = GetWeaponCue(cueEnum);

            if ((weaponCue == null) || (weaponCue.Value.IsPlaying == false))
            {
                m_cueEnum = cueEnum;
                AddWeaponCue(cueEnum);
            }
        }
 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 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;
 }
Ejemplo n.º 21
0
        public MySoundCue CreateCue(Cue xactCue, MySoundCuesEnum cueEnum, bool apply3d)
        {
            var cue = m_pool.Allocate();

            if (cue == null)
            {
                throw new InvalidOperationException("Cue pool is empty!");
            }

            cue.OnInit(xactCue, cueEnum);
            m_activeCues.Add(xactCue.NativePointer.ToInt64(), cue);

            return(new MySoundCue(cue.Cue, cueEnum, apply3d));
        }
 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;
     }
 }
Ejemplo n.º 23
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;
     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;
     PauseBefore_ms = pauseBefore_ms;
     if (MyActorConstants.IsNoiseActor(speaker))
     {
         Noise = 1f;
     }
 }
Ejemplo n.º 24
0
        public void Init(StringBuilder hudLabelText, MyMwcObjectBuilder_InfluenceSphere objectBuilder, Matrix matrix)
        {
            // Influence spheres dont have hud label text
            base.Init(hudLabelText, objectBuilder);

            InfluenceFlags = objectBuilder.InfluenceFlags;

            m_radiusMin = objectBuilder.RadiusMin;
            RadiusMax   = objectBuilder.RadiusMax;
            DustColor   = objectBuilder.DustColor;
            Magnitude   = objectBuilder.Magnitude;

            VisibleInGame = false;

            SetWorldMatrix(matrix);

            Enabled = objectBuilder.Enabled;

            NeedsUpdate = Enabled;
            Save        = true;

            //m_soundType = objectBuilder.SoundType;
            //MySoundCuesEnum cueEnum = GetSoundCueByObjectBuilderType(m_soundType);
            //m_cueEnum = cueEnum;
            m_cueEnum = (MySoundCuesEnum)objectBuilder.SoundCueId;

            if ((InfluenceFlags & MyInfluenceFlags.Sound) > 0)
            {
                MyGuiInfluenceSphereHelper musicHelper = MyGuiInfluenceSphereHelpers.GetInfluenceSphereSoundHelper(m_cueEnum);
                if (musicHelper == null || !musicHelper.Description.ToString().ToLower().StartsWith("amb2d_"))
                {
                    if (musicHelper == null)
                    {
                        Debug.Fail("Incorrect influence sphere sound doesn't exist");
                        MyMwcLog.WriteLine("Incorrect influence sphere sound doesn't exist");
                    }
                    else
                    {
                        Debug.Fail("Incorrect influence sphere sound: " + musicHelper.Description.ToString() + ", deleted");
                        MyMwcLog.WriteLine("Incorrect influence sphere sound: " + musicHelper.Description.ToString() + ", deleted");
                    }
                }
            }

            Flags |= EntityFlags.EditableInEditor;
        }
Ejemplo n.º 25
0
        protected override void InitPrefab(string displayName, Vector3 relativePosition, Matrix localOrientation, MyMwcObjectBuilder_PrefabBase objectBuilder, MyPrefabConfiguration prefabConfig)
        {
            m_prefabSoundConfig = prefabConfig as MyPrefabConfigurationSound;            

            MyModel model = MyModels.GetModelOnlyDummies(m_prefabSoundConfig.ModelLod0Enum);
            m_pointLocalMatrix = Matrix.Identity;
            m_cueEnum = m_prefabSoundConfig.Sound;
            foreach (KeyValuePair<string, MyModelDummy> pair in model.Dummies)
            {
                m_pointLocalMatrix = pair.Value.Matrix;
            }

            if (IsWorking())
            {
                PlaySound();
            }
        }
Ejemplo n.º 26
0
        protected override void InitPrefab(string displayName, Vector3 relativePosition, Matrix localOrientation, MyMwcObjectBuilder_PrefabBase objectBuilder, MyPrefabConfiguration prefabConfig)
        {
            m_prefabSoundConfig = prefabConfig as MyPrefabConfigurationSound;

            MyModel model = MyModels.GetModelOnlyDummies(m_prefabSoundConfig.ModelLod0Enum);

            m_pointLocalMatrix = Matrix.Identity;
            m_cueEnum          = m_prefabSoundConfig.Sound;
            foreach (KeyValuePair <string, MyModelDummy> pair in model.Dummies)
            {
                m_pointLocalMatrix = pair.Value.Matrix;
            }

            if (IsWorking())
            {
                PlaySound();
            }
        }
Ejemplo n.º 27
0
        public static bool AddHudCue(MySoundCuesEnum cueEnum, float volume)
        {
            // Playing cue right now?
            if (m_activeCue.HasValue && m_activeCue.Value.CueEnum == cueEnum)
                return false;

            foreach (var hudCue in m_hudCuesQueue)
            {
                if (hudCue.CueEnum == cueEnum)
                {
                    return false;
                }
            }

            m_hudCuesQueue.Enqueue(new MyHudCue() { CueEnum = cueEnum, Volume = volume });
            Debug.Assert(m_hudCuesQueue.Count < 100, "Too many hud sounds were enqueued, are you checking if sound was already enqueud?");
            return true;
        }
Ejemplo n.º 28
0
        public MySourceVoice GetVoice(MySoundCuesEnum cueEnum)
        {
            MyObjectBuilder_CueDefinition cue = GetCue(cueEnum);

            if ((cue == null) || (cue.Waves == null) || (cue.Waves.Length == 0))
            {
                return(null);
            }

            MyInMemoryWave wave = GetRandomWave(cue);

            if (wave == null)
            {
                return(null);
            }

            MyWaveFormat myWaveFormat = new MyWaveFormat()
            {
                Encoding   = wave.WaveFormat.Encoding,
                Channels   = wave.WaveFormat.Channels,
                SampleRate = wave.WaveFormat.SampleRate,
                WaveFormat = wave.WaveFormat
            };

            MySourceVoice voice = m_voicePools[myWaveFormat].NextAvailable();

            if (voice == null)
            {
                return(null);
            }

            voice.SubmitSourceBuffer(cueEnum, wave.Buffer, wave.Stream.DecodedPacketsInfo, wave.WaveFormat.SampleRate);
            if (m_applyReverb)
            {
                voice.Voice.SetEffectChain(m_effectDescriptor);
                voice.Voice.EnableEffect(0);
            }
            else
            {
                voice.Voice.SetEffectChain(null);
            }

            return(voice);
        }
Ejemplo n.º 29
0
        public readonly MyCustomHitMaterialMethod OnHitMaterialSpecificParticles; // Delegate to method to create material specific particles

        public MyAmmoProperties(float InitialSpeed,
                                float DesiredSpeed,
                                float SpeedVar,
                                float MaxTrajectory,
                                float HealthDamage,
                                float ShipDamage,
                                float EMPDamage,
                                float ExplosionRadius,
                                float DeviateAngle,
                                Vector3 TrailColor,
                                MySoundCuesEnum ShotSound,
                                bool IsExplosive,
                                bool AllowAimCorrection,
                                float DecalEmissivity,
                                int ProjectileGroupSize,
                                MyDamageType DamageType,
                                MyAmmoType AmmoType,

                                MyCustomHitParticlesMethod OnHitParticles,
                                MyCustomHitMaterialMethod OnHitMaterialSpecificParticles)
        {
            this.InitialSpeed = InitialSpeed;
            this.DesiredSpeed = DesiredSpeed;
            this.SpeedVar = SpeedVar;
            this.MaxTrajectory = MaxTrajectory;
            this.HealthDamage = HealthDamage;
            this.ShipDamage = ShipDamage;
            this.EMPDamage = EMPDamage;
            this.ExplosionRadius = ExplosionRadius;
            this.DeviateAngle = DeviateAngle;
            this.TrailColor = TrailColor;
            this.ShotSound = ShotSound;
            this.IsExplosive = IsExplosive;
            this.AllowAimCorrection = AllowAimCorrection;
            this.DecalEmissivity = DecalEmissivity;
            this.ProjectileGroupSize = ProjectileGroupSize;

            this.DamageType = DamageType;
            this.AmmoType = AmmoType;

            this.OnHitParticles = OnHitParticles;
            this.OnHitMaterialSpecificParticles = OnHitMaterialSpecificParticles;
        }
Ejemplo n.º 30
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);
        }
Ejemplo n.º 32
0
        public static bool AddHudCue(MySoundCuesEnum cueEnum, float volume)
        {
            // Playing cue right now?
            if (m_activeCue.HasValue && m_activeCue.Value.CueEnum == cueEnum)
            {
                return(false);
            }

            foreach (var hudCue in m_hudCuesQueue)
            {
                if (hudCue.CueEnum == cueEnum)
                {
                    return(false);
                }
            }

            m_hudCuesQueue.Enqueue(new MyHudCue()
            {
                CueEnum = cueEnum, Volume = volume
            });
            Debug.Assert(m_hudCuesQueue.Count < 100, "Too many hud sounds were enqueued, are you checking if sound was already enqueud?");
            return(true);
        }
Ejemplo n.º 33
0
 public void PlaySingleSound(MySoundCuesEnum cueEnum, bool update)
 {
     CueEnum = cueEnum;
     Sound   = MyAudio.PlayCue3D(this, CueEnum, update);
 }
Ejemplo n.º 34
0
 protected void AddWeaponCue(MySoundCuesEnum cueEnum)
 {
     GetParentMinerShip().UnifiedWeaponCueSet(cueEnum, MyAudio.AddCue2dOr3d(GetParentMinerShip(), cueEnum,
                                                                            m_positionMuzzleInWorldSpace, Parent.WorldMatrix.Forward, Parent.WorldMatrix.Up, Parent.Physics.LinearVelocity));
 }
Ejemplo n.º 35
0
 protected MySoundCue?GetWeaponCue(MySoundCuesEnum cueEnum)
 {
     return(GetParentMinerShip().UnifiedWeaponCueGet(cueEnum));
 }
Ejemplo n.º 36
0
 /// <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!");
     }
 }
Ejemplo n.º 37
0
        /// <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;
        }
Ejemplo n.º 38
0
 public void ChangeCueEnum(MySoundCuesEnum soundCue)
 {
     m_cueEnum = soundCue;
 }
Ejemplo n.º 39
0
 /// <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;
 }
Ejemplo n.º 40
0
 public MyCueParameters(bool useOcclusion, MySoundCuesEnum? wrapper2dEnum, bool loopable, float maxDistance, bool isHudCue)
     : this(useOcclusion, wrapper2dEnum, loopable, maxDistance)
 {
     IsHudCue = isHudCue;
 }
Ejemplo n.º 41
0
 static void AddMusicCategory(MyMusicTransitionEnum musicTransition, string category, MySoundCuesEnum cueEnum)
 {
     if (m_musicTransitionCues[(int)musicTransition] == null)
     {
         m_musicTransitionCues[(int)musicTransition] = new Dictionary<string, MySoundCuesEnum>();
     }
     m_musicTransitionCues[(int)musicTransition].Add(category, cueEnum);
 }
Ejemplo n.º 42
0
 public void StartLoopSound(MySoundCuesEnum cueEnum)
 {
     MySoundCue? weaponCue = GetWeaponCue(cueEnum);
     if ((weaponCue == null) || (weaponCue.Value.IsPlaying == false))
     {
         m_cueEnum = cueEnum;
         AddWeaponCue(cueEnum);
     }
 }
Ejemplo n.º 43
0
 public MyObjectBuilder_CueDefinition GetCue(MySoundCuesEnum cueEnum)
 {
     return(m_cues[(int)cueEnum]);
 }
Ejemplo n.º 44
0
 public MySoundCue? UnifiedWeaponCueGet(MySoundCuesEnum cueEnum)
 {
     return m_unifiedWeaponCues[(int)cueEnum];
 }
Ejemplo n.º 45
0
 //  Weapons sounds are unified per miner ship (two or more weapons of same type and shooting simultanously will produce only one sound)
 public void UnifiedWeaponCueSet(MySoundCuesEnum cueEnum, MySoundCue? value)
 {
     m_unifiedWeaponCues[(int)cueEnum] = value;
 }
Ejemplo n.º 46
0
 public void OnInit(Cue cue, MySoundCuesEnum cueEnum)
 {
     Cue.m_cue   = cue;
     Cue.CueEnum = cueEnum;
 }
Ejemplo n.º 47
0
 public MyPrefabConfigurationSound(MyModelsEnum modelLod0Enum, MyModelsEnum?modelLod1Enum, BuildTypesEnum buildType, CategoryTypesEnum categoryType,
                                   SubCategoryTypesEnum?subCategoryType, MyMaterialType materialType, MySoundCuesEnum sound)
     : this(modelLod0Enum, modelLod1Enum, buildType, categoryType, subCategoryType, materialType, sound, PrefabTypesFlagEnum.Default)
 {
 }
Ejemplo n.º 48
0
 public static MySoundCuesEnum GetVersion2D(MySoundCuesEnum cueEnum3D)
 {
     MyCueParameters cueParams = m_cueParameters[(int)cueEnum3D].Value;
     if (cueParams.Wrapped2dEnum.HasValue)
     {
         return cueParams.Wrapped2dEnum.Value;
     }
     else
     {
         //  If we can't find 2D version for specified sound, we return 3D version so at least something is played
         return cueEnum3D;
     }
 }
Ejemplo n.º 49
0
        //  Every child of this base class must implement Shot() method, which shots projectile or missile.
        //  Method returns true if something was shot. False if not (because interval between two shots didn't pass)
        public override bool Shot(MyMwcObjectBuilder_SmallShip_Ammo usedAmmo)
        {
            if (GetParentMinerShip() == null)
            {
                return(false);
            }

            //  Allow shoting only at intervals
            if ((MyMinerGame.TotalGamePlayTimeInMilliseconds - m_lastTimeShoot) < MyAutocanonConstants.SHOT_INTERVAL_IN_MILISECONDS && !IsDummy)
            {
                return(false);
            }
            //  Stop 'release cue' if playing
            MySoundCue?autocanonReleaseCue = GetParentMinerShip().UnifiedWeaponCueGet(AUTOCANON_RELEASE);

            if ((autocanonReleaseCue != null) && (autocanonReleaseCue.Value.IsPlaying == true))
            {
                autocanonReleaseCue.Value.Stop(SharpDX.XACT3.StopFlags.Immediate);
            }

            //  Angle of muzzle flash particle
            m_muzzleFlashLength = MyMwcUtils.GetRandomFloat(3, 4) * m_barrel.GetMuzzleSize();
            m_muzzleFlashRadius = MyMwcUtils.GetRandomFloat(1.8f, 2.2f) * m_barrel.GetMuzzleSize();

            //  Increase count of smokes to draw
            SmokesToGenerateIncrease();

            //Use looping cue only in playership
            MySoundCuesEnum attackCue = GetParentMinerShip() == MySession.PlayerShip ? AUTOCANON_ATTACK_LOOP : AUTOCANON_ATTACK;

            //  Start 'attack and loop' cue (shooting)
            MySoundCue?autocanonAttackLoopCue = GetParentMinerShip().UnifiedWeaponCueGet(attackCue);

            if ((autocanonAttackLoopCue == null) || (autocanonAttackLoopCue.Value.IsPlaying == false))
            {
                //MyMwcLog.WriteLine("Adding new AUTOCANNON attack loop");
                GetParentMinerShip().UnifiedWeaponCueSet(
                    attackCue,
                    MyAudio.AddCue2dOr3d(GetParentMinerShip(), attackCue,
                                         m_positionMuzzleInWorldSpace, WorldMatrix.Forward, WorldMatrix.Up, Parent.Physics.LinearVelocity));
            }

            MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType = MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_Basic;

            if (usedAmmo != null) //TODO: bot fires without ammo
            {
                ammoType = usedAmmo.AmmoType;
            }

            MyAmmoProperties ammoProperties = MyAmmoConstants.GetAmmoProperties(ammoType);

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyAutocannonGun.Shot add projectile");

            if (MyMwcFinalBuildConstants.ENABLE_TRAILER_SAVE)
            {
                MinerWars.AppCode.Game.Trailer.MyTrailerSave.UpdateGunShot(this.Parent, Trailer.MyTrailerGunsShotTypeEnum.PROJECTILE);
            }

            AddProjectile(ammoProperties, this);
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();

            m_cannonMotorEndPlayed = false;
            m_lastTimeShoot        = MyMinerGame.TotalGamePlayTimeInMilliseconds;

            //  We shot one projectile
            return(true);
        }
Ejemplo n.º 50
0
 public MyCueParameters(bool useOcclusion, MySoundCuesEnum? wrapped2dEnum, bool loopable, float maxDistance)
     : this(useOcclusion, wrapped2dEnum, loopable)
 {
     MaxDistance = maxDistance;
 }
Ejemplo n.º 51
0
 private void AddMusicCategory(MyMusicTransitionEnum musicTransition, string category, MySoundCuesEnum cueEnum)
 {
     if (m_musicTransitionCues[(int)musicTransition] == null)
     {
         m_musicTransitionCues[(int)musicTransition] = new Dictionary <string, MySoundCuesEnum>();
     }
     m_musicTransitionCues[(int)musicTransition].Add(category, cueEnum);
 }
Ejemplo n.º 52
0
 /// <summary>
 /// Creates new instance of MyHudSoundWarning, without repeating
 /// </summary>
 /// <param name="sound">Sound to play</param>
 public MyHudSoundWarning(MySoundCuesEnum sound)
     : this(sound, 0)
 {
 }
Ejemplo n.º 53
0
 public void PlayIntroLoopPair(MySoundCuesEnum introCueEnum, MySoundCuesEnum loopCueEnum)
 {
     CueEnum = loopCueEnum;
     Sound   = MyAudio.PlayIntroLoopPair3D(this, introCueEnum, loopCueEnum);
 }
Ejemplo n.º 54
0
 public MyPrefabConfigurationSound(MyModelsEnum modelLod0Enum, MyModelsEnum?modelLod1Enum, BuildTypesEnum buildType, CategoryTypesEnum categoryType,
                                   SubCategoryTypesEnum?subCategoryType, MyMaterialType materialType, MySoundCuesEnum sound, PrefabTypesFlagEnum prefabTypesFlag)
     : base(modelLod0Enum, modelLod1Enum, buildType, categoryType, subCategoryType, materialType, prefabTypesFlag, needsUpdate: true)
 {
     Sound = sound;
 }
        public void SendPlaySound(Vector3? position, MySoundCuesEnum id)
        {
            var msg = new MyEventPlaySound();
            msg.Position = position;
            msg.SoundEnum = (int)id;

            Peers.SendToAll(ref msg, NetDeliveryMethod.ReliableOrdered);
        }
Ejemplo n.º 56
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;
 }