protected override void ReadData(ESPReader reader)
 {
     using (MemoryStream stream = new MemoryStream(reader.ReadBytes(size)))
         using (ESPReader subReader = new ESPReader(stream, reader.Plugin))
         {
             try
             {
                 Force  = subReader.ReadSingle();
                 Damage = subReader.ReadSingle();
                 Radius = subReader.ReadSingle();
                 Light.ReadBinary(subReader);
                 Sound1.ReadBinary(subReader);
                 Flags    = subReader.ReadEnum <ExplosionFlags>();
                 ISRadius = subReader.ReadSingle();
                 ImpactDataSet.ReadBinary(subReader);
                 Sound2.ReadBinary(subReader);
                 RadiationLevel           = subReader.ReadSingle();
                 RadiationDissipationTime = subReader.ReadSingle();
                 RadiationRadius          = subReader.ReadSingle();
                 SoundLevel = subReader.ReadEnum <SoundLevel>();
             }
             catch
             {
                 return;
             }
         }
 }
Beispiel #2
0
        public override void Draw(GameTime gameTime, object param)
        {
            base.Draw(gameTime, param);
            Vector2     length      = Global.gDefaultMediumFont.MeasureString("3");
            SpriteBatch spriteBatch = param as SpriteBatch;

            spriteBatch.DrawString(Global.gDefaultLargeFont, "How to play", new Vector2(102.5f, 77), Color.FromNonPremultiplied(206, 235, 12, 255), 0f, Vector2.Zero, 1f, SpriteEffects.None, 1);
            spriteBatch.DrawString(Global.gDefaultMediumFont, "Cat", new Vector2(123.5f, 177), Color.FromNonPremultiplied(206, 235, 12, 255), 0f, Vector2.Zero, 1f, SpriteEffects.None, 1);
            spriteBatch.DrawString(Global.gDefaultMediumFont, "Left: A", new Vector2(92.5f, 252), Color.FromNonPremultiplied(206, 235, 12, 255), 0f, Vector2.Zero, 1f, SpriteEffects.None, 1);
            spriteBatch.DrawString(Global.gDefaultMediumFont, "Right: D", new Vector2(75.5f, 327), Color.FromNonPremultiplied(206, 235, 12, 255), 0f, Vector2.Zero, 1f, SpriteEffects.None, 1);
            spriteBatch.DrawString(Global.gDefaultMediumFont, "Jump: W", new Vector2(70.5f, 402), Color.FromNonPremultiplied(206, 235, 12, 255), 0f, Vector2.Zero, 1f, SpriteEffects.None, 1);
            spriteBatch.DrawString(Global.gDefaultMediumFont, "Down: S", new Vector2(77, 477), Color.FromNonPremultiplied(206, 235, 12, 255), 0f, Vector2.Zero, 1f, SpriteEffects.None, 1);

            spriteBatch.DrawString(Global.gDefaultMediumFont, "Dog", new Vector2(443.5f, 177), Color.FromNonPremultiplied(206, 235, 12, 255), 0f, Vector2.Zero, 1f, SpriteEffects.None, 1);
            spriteBatch.DrawString(Global.gDefaultMediumFont, "Left: Left", new Vector2(393.5f, 252), Color.FromNonPremultiplied(206, 235, 12, 255), 0f, Vector2.Zero, 1f, SpriteEffects.None, 1);
            spriteBatch.DrawString(Global.gDefaultMediumFont, "Right: Right", new Vector2(357.5f, 327), Color.FromNonPremultiplied(206, 235, 12, 255), 0f, Vector2.Zero, 1f, SpriteEffects.None, 1);
            spriteBatch.DrawString(Global.gDefaultMediumFont, "Jump: Up", new Vector2(382, 402), Color.FromNonPremultiplied(206, 235, 12, 255), 0f, Vector2.Zero, 1f, SpriteEffects.None, 1);
            spriteBatch.DrawString(Global.gDefaultMediumFont, "Down: Down", new Vector2(351.5f, 477), Color.FromNonPremultiplied(206, 235, 12, 255), 0f, Vector2.Zero, 1f, SpriteEffects.None, 1);

            spriteBatch.DrawString(Global.gDefaultLargeFont, "Audio", new Vector2(897, 77), Color.FromNonPremultiplied(206, 235, 12, 255), 0f, Vector2.Zero, 1f, SpriteEffects.None, 1);
            spriteBatch.DrawString(Global.gDefaultMediumFont, "Music", new Vector2(806, 177), Color.FromNonPremultiplied(206, 235, 12, 255), 0f, Vector2.Zero, 1f, SpriteEffects.None, 1);
            spriteBatch.DrawString(Global.gDefaultMediumFont, "Sound", new Vector2(808, 252), Color.FromNonPremultiplied(206, 235, 12, 255), 0f, Vector2.Zero, 1f, SpriteEffects.None, 1);
            musicDown.Draw(gameTime, param);
            spriteBatch.DrawString(Global.gDefaultMediumFont, MusicLevel.ToString(), new Vector2(1057, 177), Color.FromNonPremultiplied(206, 235, 12, 255), 0f, Vector2.Zero, 1f, SpriteEffects.None, 1);
            musicUp.Draw(gameTime, param);
            soundDown.Draw(gameTime, param);
            spriteBatch.DrawString(Global.gDefaultMediumFont, SoundLevel.ToString(), new Vector2(1057, 252), Color.FromNonPremultiplied(206, 235, 12, 255), 0f, Vector2.Zero, 1f, SpriteEffects.None, 1);
            soundUp.Draw(gameTime, param);

            back.Draw(gameTime, param);
        }
 public ExplosionData(ExplosionData copyObject)
 {
     Force  = copyObject.Force;
     Damage = copyObject.Damage;
     Radius = copyObject.Radius;
     if (copyObject.Light != null)
     {
         Light = (FormID)copyObject.Light.Clone();
     }
     if (copyObject.Sound1 != null)
     {
         Sound1 = (FormID)copyObject.Sound1.Clone();
     }
     Flags    = copyObject.Flags;
     ISRadius = copyObject.ISRadius;
     if (copyObject.ImpactDataSet != null)
     {
         ImpactDataSet = (FormID)copyObject.ImpactDataSet.Clone();
     }
     if (copyObject.Sound2 != null)
     {
         Sound2 = (FormID)copyObject.Sound2.Clone();
     }
     RadiationLevel           = copyObject.RadiationLevel;
     RadiationDissipationTime = copyObject.RadiationDissipationTime;
     RadiationRadius          = copyObject.RadiationRadius;
     SoundLevel = copyObject.SoundLevel;
 }
Beispiel #4
0
 // Update is called once per frame
 void Update()
 {
     //Increase size of the circle radius is wasd are pressed. C makes player crouch, left shift is noraml walking else player is running, if not moving no noise being made.
     if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.D))
     {
         if (Input.GetKey(KeyCode.C))
         {
             Emitter = SoundLevel.Quiet;
             colliderEmitter.radius = 1.0f;
         }
         else if (Input.GetKey(KeyCode.LeftShift))
         {
             Emitter = SoundLevel.Normal;
             colliderEmitter.radius = 2.5f;
         }
         else
         {
             Emitter = SoundLevel.Loud;
             colliderEmitter.radius = 5.0f;
         }
     }
     else
     {
         Emitter = SoundLevel.None;
         colliderEmitter.radius = 0f;
     }
 }
Beispiel #5
0
        /***************************************************/

        public static SoundLevel SoundLevelsSum(this List <SoundLevel> spl)
        {
            SoundLevel totalLevel = new SoundLevel();

            for (int i = 0; i < spl.Count; i++)
            {
                totalLevel += spl[i];
            }
            return(totalLevel);
        }
 public ImpactData(string Tag = null)
     : base(Tag)
 {
     EffectDuration    = new Single();
     EffectOrientation = new ImpactOrientation();
     AngleThreshold    = new Single();
     PlacementRadius   = new Single();
     SoundLevel        = new SoundLevel();
     HasDecalData      = new YesNoUInt();
 }
 public void ChangeSoundLevel()
 {
     m_soundLevel++;
     if (m_soundLevel > 3)
     {
         m_soundLevel = 0;
     }
     LEVEL = (SoundLevel)m_soundLevel;
     Debug.Log(LEVEL);
 }
Beispiel #8
0
    // Use this for initialization
    void Awake()
    {
        bridges = new List<EmptyBridge>();
        walls = new List<AudioWall>();

        soundClass = GameObject.Find("SoundLevel").GetComponent<SoundLevel>();
        soundAnalyser = gameObject.GetComponent<AnalyseSound>();

        soundAnalyser = (AnalyseSound)gameObject.AddComponent<AnalyseSound>();
        soundAnalyser.sound = sound;
    }
 public ExplosionData(Single Force, Single Damage, Single Radius, FormID Light, FormID Sound1, ExplosionFlags Flags, Single ISRadius, FormID ImpactDataSet, FormID Sound2, Single RadiationLevel, Single RadiationDissipationTime, Single RadiationRadius, SoundLevel SoundLevel)
 {
     this.Force                    = Force;
     this.Damage                   = Damage;
     this.Radius                   = Radius;
     this.Light                    = Light;
     this.Sound1                   = Sound1;
     this.Flags                    = Flags;
     this.ISRadius                 = ISRadius;
     this.ImpactDataSet            = ImpactDataSet;
     this.Sound2                   = Sound2;
     this.RadiationLevel           = RadiationLevel;
     this.RadiationDissipationTime = RadiationDissipationTime;
     this.RadiationRadius          = RadiationRadius;
     this.SoundLevel               = SoundLevel;
 }
 public ExplosionData(string Tag = null)
     : base(Tag)
 {
     Force                    = new Single();
     Damage                   = new Single();
     Radius                   = new Single();
     Light                    = new FormID();
     Sound1                   = new FormID();
     Flags                    = new ExplosionFlags();
     ISRadius                 = new Single();
     ImpactDataSet            = new FormID();
     Sound2                   = new FormID();
     RadiationLevel           = new Single();
     RadiationDissipationTime = new Single();
     RadiationRadius          = new Single();
     SoundLevel               = new SoundLevel();
 }
Beispiel #11
0
        /***************************************************/
        /**** Public  Methods                           ****/
        /***************************************************/

        public static SoundLevel DirectSound(this Receiver receiver, List <Speaker> speakers, Room room, double revTime, Frequency frequency)
        {
            SoundLevel directSound = new SoundLevel();

            foreach (Speaker speaker in speakers)
            {
                Vector deltaPos     = receiver.Location - speaker.Location;
                double distance     = deltaPos.Length();
                double roomConstant = room.RoomConstant(revTime);

                double recieverAngle     = deltaPos.Angle(speaker.Direction) * (180 / Math.PI);
                double orientationFactor = speaker.GainFactor(recieverAngle, frequency);
                double gain = speaker.Gains[frequency] * Math.Pow(10, orientationFactor / 10);
                directSound += Create.SoundLevel((speaker.EmissiveLevel / (4.0 * Math.PI * distance * distance)) + (4.0 / roomConstant),
                                                 receiver.ReceiverID, -1, frequency);
            }
            return(Create.SoundLevel(directSound.Value + speakers.First().EmissiveLevel, receiver.ReceiverID, -1, frequency));
        }
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Effect/Duration", true, out subEle);
            subEle.Value = EffectDuration.ToString("G15");

            ele.TryPathTo("Effect/Orientation", true, out subEle);
            subEle.Value = EffectOrientation.ToString();

            ele.TryPathTo("AngleThreshold", true, out subEle);
            subEle.Value = AngleThreshold.ToString("G15");

            ele.TryPathTo("PlacementRadius", true, out subEle);
            subEle.Value = PlacementRadius.ToString("G15");

            ele.TryPathTo("SoundLevel", true, out subEle);
            subEle.Value = SoundLevel.ToString();

            ele.TryPathTo("HasDecalData", true, out subEle);
            subEle.Value = HasDecalData.ToString();
        }
        //If your app is playing media you feel that a user should not miss if a VOIP call comes in, you may
        //want to consider pausing playback when your app receives a SoundLevel(Low) notification.
        //A SoundLevel(Low) means your app volume has been attenuated by the system (likely for a VOIP call).

        string SoundLevelToString(SoundLevel level)
        {
            string LevelString;

            switch (level)
            {
            case SoundLevel.Muted:
                LevelString = "Muted";
                break;

            case SoundLevel.Low:
                LevelString = "Low";
                break;

            case SoundLevel.Full:
                LevelString = "Full";
                break;

            default:
                LevelString = "Unknown";
                break;
            }
            return(LevelString);
        }
 /// <summary>
 /// Sets sound level. Saves it in preferences.
 /// </summary>
 /// <param name="soundLevel">Sound level to set.</param>
 public static void SetSoundLevel(SoundLevel soundLevel)
 {
     PlayerPrefs.SetInt(soundLevelPrefsKey, soundLevel.Level);
 }
 public override void WriteData(ESPWriter writer)
 {
     if (EditorID != null)
     {
         EditorID.WriteBinary(writer);
     }
     if (ObjectBounds != null)
     {
         ObjectBounds.WriteBinary(writer);
     }
     if (Name != null)
     {
         Name.WriteBinary(writer);
     }
     if (Model != null)
     {
         Model.WriteBinary(writer);
     }
     if (ActorEffects != null)
     {
         ActorEffects.Sort();
         foreach (var item in ActorEffects)
         {
             item.WriteBinary(writer);
         }
     }
     if (UnarmedAttackEffect != null)
     {
         UnarmedAttackEffect.WriteBinary(writer);
     }
     if (UnarmedAttackAnimation != null)
     {
         UnarmedAttackAnimation.WriteBinary(writer);
     }
     if (Models != null)
     {
         Models.WriteBinary(writer);
     }
     if (TextureHashes != null)
     {
         TextureHashes.WriteBinary(writer);
     }
     if (BaseStats != null)
     {
         BaseStats.WriteBinary(writer);
     }
     if (Factions != null)
     {
         Factions.Sort();
         foreach (var item in Factions)
         {
             item.WriteBinary(writer);
         }
     }
     if (DeathItem != null)
     {
         DeathItem.WriteBinary(writer);
     }
     if (VoiceType != null)
     {
         VoiceType.WriteBinary(writer);
     }
     if (Template != null)
     {
         Template.WriteBinary(writer);
     }
     if (Destructable != null)
     {
         Destructable.WriteBinary(writer);
     }
     if (Script != null)
     {
         Script.WriteBinary(writer);
     }
     if (Contents != null)
     {
         Contents.Sort();
         foreach (var item in Contents)
         {
             item.WriteBinary(writer);
         }
     }
     if (AIData != null)
     {
         AIData.WriteBinary(writer);
     }
     if (Packages != null)
     {
         foreach (var item in Packages)
         {
             item.WriteBinary(writer);
         }
     }
     if (Animations != null)
     {
         Animations.WriteBinary(writer);
     }
     if (Data != null)
     {
         Data.WriteBinary(writer);
     }
     if (AttackReach != null)
     {
         AttackReach.WriteBinary(writer);
     }
     if (CombatStyle != null)
     {
         CombatStyle.WriteBinary(writer);
     }
     if (BodyPartData != null)
     {
         BodyPartData.WriteBinary(writer);
     }
     if (TurningSpeed != null)
     {
         TurningSpeed.WriteBinary(writer);
     }
     if (BaseScale != null)
     {
         BaseScale.WriteBinary(writer);
     }
     if (FootWeight != null)
     {
         FootWeight.WriteBinary(writer);
     }
     if (ImpactMaterialType != null)
     {
         ImpactMaterialType.WriteBinary(writer);
     }
     if (SoundLevel != null)
     {
         SoundLevel.WriteBinary(writer);
     }
     if (SoundTemplate != null)
     {
         SoundTemplate.WriteBinary(writer);
     }
     if (SoundData != null)
     {
         foreach (var item in SoundData)
         {
             item.WriteBinary(writer);
         }
     }
     if (ImpactDataset != null)
     {
         ImpactDataset.WriteBinary(writer);
     }
     if (MeleeWeaponList != null)
     {
         MeleeWeaponList.WriteBinary(writer);
     }
 }
 public ImpactData(Single EffectDuration, ImpactOrientation EffectOrientation, Single AngleThreshold, Single PlacementRadius, SoundLevel SoundLevel, YesNoUInt HasDecalData)
 {
     this.EffectDuration    = EffectDuration;
     this.EffectOrientation = EffectOrientation;
     this.AngleThreshold    = AngleThreshold;
     this.PlacementRadius   = PlacementRadius;
     this.SoundLevel        = SoundLevel;
     this.HasDecalData      = HasDecalData;
 }
        public override void ReadDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (ele.TryPathTo("EditorID", false, out subEle))
            {
                if (EditorID == null)
                {
                    EditorID = new SimpleSubrecord <String>();
                }

                EditorID.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("ObjectBounds", false, out subEle))
            {
                if (ObjectBounds == null)
                {
                    ObjectBounds = new ObjectBounds();
                }

                ObjectBounds.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Name", false, out subEle))
            {
                if (Name == null)
                {
                    Name = new SimpleSubrecord <String>();
                }

                Name.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Model", false, out subEle))
            {
                if (Model == null)
                {
                    Model = new Model();
                }

                Model.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("ActorEffects", false, out subEle))
            {
                if (ActorEffects == null)
                {
                    ActorEffects = new List <RecordReference>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    RecordReference tempSPLO = new RecordReference();
                    tempSPLO.ReadXML(e, master);
                    ActorEffects.Add(tempSPLO);
                }
            }
            if (ele.TryPathTo("Unarmed/AttackEffect", false, out subEle))
            {
                if (UnarmedAttackEffect == null)
                {
                    UnarmedAttackEffect = new RecordReference();
                }

                UnarmedAttackEffect.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Unarmed/AttackAnimation", false, out subEle))
            {
                if (UnarmedAttackAnimation == null)
                {
                    UnarmedAttackAnimation = new SimpleSubrecord <UInt16>();
                }

                UnarmedAttackAnimation.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Models", false, out subEle))
            {
                if (Models == null)
                {
                    Models = new SubNullStringList();
                }

                Models.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("TextureHashes", false, out subEle))
            {
                if (TextureHashes == null)
                {
                    TextureHashes = new SimpleSubrecord <Byte[]>();
                }

                TextureHashes.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("BaseStats", false, out subEle))
            {
                if (BaseStats == null)
                {
                    BaseStats = new CreatureBaseStats();
                }

                BaseStats.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Factions", false, out subEle))
            {
                if (Factions == null)
                {
                    Factions = new List <FactionMembership>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    FactionMembership tempSNAM = new FactionMembership();
                    tempSNAM.ReadXML(e, master);
                    Factions.Add(tempSNAM);
                }
            }
            if (ele.TryPathTo("DeathItem", false, out subEle))
            {
                if (DeathItem == null)
                {
                    DeathItem = new RecordReference();
                }

                DeathItem.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("VoiceType", false, out subEle))
            {
                if (VoiceType == null)
                {
                    VoiceType = new RecordReference();
                }

                VoiceType.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Template", false, out subEle))
            {
                if (Template == null)
                {
                    Template = new RecordReference();
                }

                Template.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Destructable", false, out subEle))
            {
                if (Destructable == null)
                {
                    Destructable = new Destructable();
                }

                Destructable.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Script", false, out subEle))
            {
                if (Script == null)
                {
                    Script = new RecordReference();
                }

                Script.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Contents", false, out subEle))
            {
                if (Contents == null)
                {
                    Contents = new List <InventoryItem>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    InventoryItem tempCNTO = new InventoryItem();
                    tempCNTO.ReadXML(e, master);
                    Contents.Add(tempCNTO);
                }
            }
            if (ele.TryPathTo("AIData", false, out subEle))
            {
                if (AIData == null)
                {
                    AIData = new AIData();
                }

                AIData.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Packages", false, out subEle))
            {
                if (Packages == null)
                {
                    Packages = new List <RecordReference>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    RecordReference tempPKID = new RecordReference();
                    tempPKID.ReadXML(e, master);
                    Packages.Add(tempPKID);
                }
            }
            if (ele.TryPathTo("Animations", false, out subEle))
            {
                if (Animations == null)
                {
                    Animations = new SubNullStringList();
                }

                Animations.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Data", false, out subEle))
            {
                if (Data == null)
                {
                    Data = new CreatureData();
                }

                Data.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("AttackReach", false, out subEle))
            {
                if (AttackReach == null)
                {
                    AttackReach = new SimpleSubrecord <Byte>();
                }

                AttackReach.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("CombatStyle", false, out subEle))
            {
                if (CombatStyle == null)
                {
                    CombatStyle = new RecordReference();
                }

                CombatStyle.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("BodyPartData", false, out subEle))
            {
                if (BodyPartData == null)
                {
                    BodyPartData = new RecordReference();
                }

                BodyPartData.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("TurningSpeed", false, out subEle))
            {
                if (TurningSpeed == null)
                {
                    TurningSpeed = new SimpleSubrecord <Single>();
                }

                TurningSpeed.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("BaseScale", false, out subEle))
            {
                if (BaseScale == null)
                {
                    BaseScale = new SimpleSubrecord <Single>();
                }

                BaseScale.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("FootWeight", false, out subEle))
            {
                if (FootWeight == null)
                {
                    FootWeight = new SimpleSubrecord <Single>();
                }

                FootWeight.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("ImpactMaterialType", false, out subEle))
            {
                if (ImpactMaterialType == null)
                {
                    ImpactMaterialType = new SimpleSubrecord <MaterialTypeUInt>();
                }

                ImpactMaterialType.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("SoundLevel", false, out subEle))
            {
                if (SoundLevel == null)
                {
                    SoundLevel = new SimpleSubrecord <SoundLevel>();
                }

                SoundLevel.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("SoundTemplate", false, out subEle))
            {
                if (SoundTemplate == null)
                {
                    SoundTemplate = new RecordReference();
                }

                SoundTemplate.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("SoundData", false, out subEle))
            {
                if (SoundData == null)
                {
                    SoundData = new List <CreatureSoundData>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    CreatureSoundData tempCSDT = new CreatureSoundData();
                    tempCSDT.ReadXML(e, master);
                    SoundData.Add(tempCSDT);
                }
            }
            if (ele.TryPathTo("ImpactDataset", false, out subEle))
            {
                if (ImpactDataset == null)
                {
                    ImpactDataset = new RecordReference();
                }

                ImpactDataset.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("MeleeWeaponList", false, out subEle))
            {
                if (MeleeWeaponList == null)
                {
                    MeleeWeaponList = new RecordReference();
                }

                MeleeWeaponList.ReadXML(subEle, master);
            }
        }
        public override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (EditorID != null)
            {
                ele.TryPathTo("EditorID", true, out subEle);
                EditorID.WriteXML(subEle, master);
            }
            if (ObjectBounds != null)
            {
                ele.TryPathTo("ObjectBounds", true, out subEle);
                ObjectBounds.WriteXML(subEle, master);
            }
            if (Name != null)
            {
                ele.TryPathTo("Name", true, out subEle);
                Name.WriteXML(subEle, master);
            }
            if (Model != null)
            {
                ele.TryPathTo("Model", true, out subEle);
                Model.WriteXML(subEle, master);
            }
            if (ActorEffects != null)
            {
                ele.TryPathTo("ActorEffects", true, out subEle);
                List <string> xmlNames = new List <string> {
                    "ActorEffect"
                };
                int i = 0;
                ActorEffects.Sort();
                foreach (var entry in ActorEffects)
                {
                    i = i % xmlNames.Count();
                    XElement newEle = new XElement(xmlNames[i]);
                    entry.WriteXML(newEle, master);
                    subEle.Add(newEle);
                    i++;
                }
            }
            if (UnarmedAttackEffect != null)
            {
                ele.TryPathTo("Unarmed/AttackEffect", true, out subEle);
                UnarmedAttackEffect.WriteXML(subEle, master);
            }
            if (UnarmedAttackAnimation != null)
            {
                ele.TryPathTo("Unarmed/AttackAnimation", true, out subEle);
                UnarmedAttackAnimation.WriteXML(subEle, master);
            }
            if (Models != null)
            {
                ele.TryPathTo("Models", true, out subEle);
                Models.WriteXML(subEle, master);
            }
            if (TextureHashes != null)
            {
                ele.TryPathTo("TextureHashes", true, out subEle);
                TextureHashes.WriteXML(subEle, master);
            }
            if (BaseStats != null)
            {
                ele.TryPathTo("BaseStats", true, out subEle);
                BaseStats.WriteXML(subEle, master);
            }
            if (Factions != null)
            {
                ele.TryPathTo("Factions", true, out subEle);
                List <string> xmlNames = new List <string> {
                    "Faction"
                };
                int i = 0;
                Factions.Sort();
                foreach (var entry in Factions)
                {
                    i = i % xmlNames.Count();
                    XElement newEle = new XElement(xmlNames[i]);
                    entry.WriteXML(newEle, master);
                    subEle.Add(newEle);
                    i++;
                }
            }
            if (DeathItem != null)
            {
                ele.TryPathTo("DeathItem", true, out subEle);
                DeathItem.WriteXML(subEle, master);
            }
            if (VoiceType != null)
            {
                ele.TryPathTo("VoiceType", true, out subEle);
                VoiceType.WriteXML(subEle, master);
            }
            if (Template != null)
            {
                ele.TryPathTo("Template", true, out subEle);
                Template.WriteXML(subEle, master);
            }
            if (Destructable != null)
            {
                ele.TryPathTo("Destructable", true, out subEle);
                Destructable.WriteXML(subEle, master);
            }
            if (Script != null)
            {
                ele.TryPathTo("Script", true, out subEle);
                Script.WriteXML(subEle, master);
            }
            if (Contents != null)
            {
                ele.TryPathTo("Contents", true, out subEle);
                List <string> xmlNames = new List <string> {
                    "Item"
                };
                int i = 0;
                Contents.Sort();
                foreach (var entry in Contents)
                {
                    i = i % xmlNames.Count();
                    XElement newEle = new XElement(xmlNames[i]);
                    entry.WriteXML(newEle, master);
                    subEle.Add(newEle);
                    i++;
                }
            }
            if (AIData != null)
            {
                ele.TryPathTo("AIData", true, out subEle);
                AIData.WriteXML(subEle, master);
            }
            if (Packages != null)
            {
                ele.TryPathTo("Packages", true, out subEle);
                List <string> xmlNames = new List <string> {
                    "Package"
                };
                int i = 0;
                foreach (var entry in Packages)
                {
                    i = i % xmlNames.Count();
                    XElement newEle = new XElement(xmlNames[i]);
                    entry.WriteXML(newEle, master);
                    subEle.Add(newEle);
                    i++;
                }
            }
            if (Animations != null)
            {
                ele.TryPathTo("Animations", true, out subEle);
                Animations.WriteXML(subEle, master);
            }
            if (Data != null)
            {
                ele.TryPathTo("Data", true, out subEle);
                Data.WriteXML(subEle, master);
            }
            if (AttackReach != null)
            {
                ele.TryPathTo("AttackReach", true, out subEle);
                AttackReach.WriteXML(subEle, master);
            }
            if (CombatStyle != null)
            {
                ele.TryPathTo("CombatStyle", true, out subEle);
                CombatStyle.WriteXML(subEle, master);
            }
            if (BodyPartData != null)
            {
                ele.TryPathTo("BodyPartData", true, out subEle);
                BodyPartData.WriteXML(subEle, master);
            }
            if (TurningSpeed != null)
            {
                ele.TryPathTo("TurningSpeed", true, out subEle);
                TurningSpeed.WriteXML(subEle, master);
            }
            if (BaseScale != null)
            {
                ele.TryPathTo("BaseScale", true, out subEle);
                BaseScale.WriteXML(subEle, master);
            }
            if (FootWeight != null)
            {
                ele.TryPathTo("FootWeight", true, out subEle);
                FootWeight.WriteXML(subEle, master);
            }
            if (ImpactMaterialType != null)
            {
                ele.TryPathTo("ImpactMaterialType", true, out subEle);
                ImpactMaterialType.WriteXML(subEle, master);
            }
            if (SoundLevel != null)
            {
                ele.TryPathTo("SoundLevel", true, out subEle);
                SoundLevel.WriteXML(subEle, master);
            }
            if (SoundTemplate != null)
            {
                ele.TryPathTo("SoundTemplate", true, out subEle);
                SoundTemplate.WriteXML(subEle, master);
            }
            if (SoundData != null)
            {
                ele.TryPathTo("SoundData", true, out subEle);
                List <string> xmlNames = new List <string> {
                    "Sound"
                };
                int i = 0;
                foreach (var entry in SoundData)
                {
                    i = i % xmlNames.Count();
                    XElement newEle = new XElement(xmlNames[i]);
                    entry.WriteXML(newEle, master);
                    subEle.Add(newEle);
                    i++;
                }
            }
            if (ImpactDataset != null)
            {
                ele.TryPathTo("ImpactDataset", true, out subEle);
                ImpactDataset.WriteXML(subEle, master);
            }
            if (MeleeWeaponList != null)
            {
                ele.TryPathTo("MeleeWeaponList", true, out subEle);
                MeleeWeaponList.WriteXML(subEle, master);
            }
        }
        //If your app is playing media you feel that a user should not miss if a VOIP call comes in, you may
        //want to consider pausing playback when your app receives a SoundLevel(Low) notification.
        //A SoundLevel(Low) means your app volume has been attenuated by the system (likely for a VOIP call).

        string SoundLevelToString(SoundLevel level)
        {
            string LevelString;

            switch (level)
            {
                case SoundLevel.Muted:
                    LevelString = "Muted";
                    break;
                case SoundLevel.Low:
                    LevelString = "Low";
                    break;
                case SoundLevel.Full:
                    LevelString = "Full";
                    break;
                default:
                    LevelString = "Unknown";
                    break;
            }
            return LevelString;
        }
Beispiel #20
0
 // Use this for initialization
 void Start()
 {
     SoundLevel = GameObject.Find("SoundLevelMonitor").GetComponent<SoundLevel>();
     nextMeow = DateTime.Now.AddMilliseconds(UnityEngine.Random.Range(500, 8000));
     catSpawned = DateTime.Now;
 }
        protected override void ReadDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (ele.TryPathTo("Force", false, out subEle))
            {
                Force = subEle.ToSingle();
            }

            if (ele.TryPathTo("Damage", false, out subEle))
            {
                Damage = subEle.ToSingle();
            }

            if (ele.TryPathTo("Radius", false, out subEle))
            {
                Radius = subEle.ToSingle();
            }

            if (ele.TryPathTo("Light", false, out subEle))
            {
                Light.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Sound1", false, out subEle))
            {
                Sound1.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Flags", false, out subEle))
            {
                Flags = subEle.ToEnum <ExplosionFlags>();
            }

            if (ele.TryPathTo("ISRadius", false, out subEle))
            {
                ISRadius = subEle.ToSingle();
            }

            if (ele.TryPathTo("ImpactDataSet", false, out subEle))
            {
                ImpactDataSet.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Sound2", false, out subEle))
            {
                Sound2.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Radiation/Level", false, out subEle))
            {
                RadiationLevel = subEle.ToSingle();
            }

            if (ele.TryPathTo("Radiation/DissipationTime", false, out subEle))
            {
                RadiationDissipationTime = subEle.ToSingle();
            }

            if (ele.TryPathTo("Radiation/Radius", false, out subEle))
            {
                RadiationRadius = subEle.ToSingle();
            }

            if (ele.TryPathTo("SoundLevel", false, out subEle))
            {
                SoundLevel = subEle.ToEnum <SoundLevel>();
            }
        }
        public override void ReadData(ESPReader reader, long dataEnd)
        {
            while (reader.BaseStream.Position < dataEnd)
            {
                string subTag = reader.PeekTag();

                switch (subTag)
                {
                case "EDID":
                    if (EditorID == null)
                    {
                        EditorID = new SimpleSubrecord <String>();
                    }

                    EditorID.ReadBinary(reader);
                    break;

                case "OBND":
                    if (ObjectBounds == null)
                    {
                        ObjectBounds = new ObjectBounds();
                    }

                    ObjectBounds.ReadBinary(reader);
                    break;

                case "FULL":
                    if (Name == null)
                    {
                        Name = new SimpleSubrecord <String>();
                    }

                    Name.ReadBinary(reader);
                    break;

                case "MODL":
                    if (Model == null)
                    {
                        Model = new Model();
                    }

                    Model.ReadBinary(reader);
                    break;

                case "SPLO":
                    if (ActorEffects == null)
                    {
                        ActorEffects = new List <RecordReference>();
                    }

                    RecordReference tempSPLO = new RecordReference();
                    tempSPLO.ReadBinary(reader);
                    ActorEffects.Add(tempSPLO);
                    break;

                case "EITM":
                    if (UnarmedAttackEffect == null)
                    {
                        UnarmedAttackEffect = new RecordReference();
                    }

                    UnarmedAttackEffect.ReadBinary(reader);
                    break;

                case "EAMT":
                    if (UnarmedAttackAnimation == null)
                    {
                        UnarmedAttackAnimation = new SimpleSubrecord <UInt16>();
                    }

                    UnarmedAttackAnimation.ReadBinary(reader);
                    break;

                case "NIFZ":
                    if (Models == null)
                    {
                        Models = new SubNullStringList();
                    }

                    Models.ReadBinary(reader);
                    break;

                case "NIFT":
                    if (TextureHashes == null)
                    {
                        TextureHashes = new SimpleSubrecord <Byte[]>();
                    }

                    TextureHashes.ReadBinary(reader);
                    break;

                case "ACBS":
                    if (BaseStats == null)
                    {
                        BaseStats = new CreatureBaseStats();
                    }

                    BaseStats.ReadBinary(reader);
                    break;

                case "SNAM":
                    if (Factions == null)
                    {
                        Factions = new List <FactionMembership>();
                    }

                    FactionMembership tempSNAM = new FactionMembership();
                    tempSNAM.ReadBinary(reader);
                    Factions.Add(tempSNAM);
                    break;

                case "INAM":
                    if (DeathItem == null)
                    {
                        DeathItem = new RecordReference();
                    }

                    DeathItem.ReadBinary(reader);
                    break;

                case "VTCK":
                    if (VoiceType == null)
                    {
                        VoiceType = new RecordReference();
                    }

                    VoiceType.ReadBinary(reader);
                    break;

                case "TPLT":
                    if (Template == null)
                    {
                        Template = new RecordReference();
                    }

                    Template.ReadBinary(reader);
                    break;

                case "DEST":
                    if (Destructable == null)
                    {
                        Destructable = new Destructable();
                    }

                    Destructable.ReadBinary(reader);
                    break;

                case "SCRI":
                    if (Script == null)
                    {
                        Script = new RecordReference();
                    }

                    Script.ReadBinary(reader);
                    break;

                case "CNTO":
                    if (Contents == null)
                    {
                        Contents = new List <InventoryItem>();
                    }

                    InventoryItem tempCNTO = new InventoryItem();
                    tempCNTO.ReadBinary(reader);
                    Contents.Add(tempCNTO);
                    break;

                case "AIDT":
                    if (AIData == null)
                    {
                        AIData = new AIData();
                    }

                    AIData.ReadBinary(reader);
                    break;

                case "PKID":
                    if (Packages == null)
                    {
                        Packages = new List <RecordReference>();
                    }

                    RecordReference tempPKID = new RecordReference();
                    tempPKID.ReadBinary(reader);
                    Packages.Add(tempPKID);
                    break;

                case "KFFZ":
                    if (Animations == null)
                    {
                        Animations = new SubNullStringList();
                    }

                    Animations.ReadBinary(reader);
                    break;

                case "DATA":
                    if (Data == null)
                    {
                        Data = new CreatureData();
                    }

                    Data.ReadBinary(reader);
                    break;

                case "RNAM":
                    if (AttackReach == null)
                    {
                        AttackReach = new SimpleSubrecord <Byte>();
                    }

                    AttackReach.ReadBinary(reader);
                    break;

                case "ZNAM":
                    if (CombatStyle == null)
                    {
                        CombatStyle = new RecordReference();
                    }

                    CombatStyle.ReadBinary(reader);
                    break;

                case "PNAM":
                    if (BodyPartData == null)
                    {
                        BodyPartData = new RecordReference();
                    }

                    BodyPartData.ReadBinary(reader);
                    break;

                case "TNAM":
                    if (TurningSpeed == null)
                    {
                        TurningSpeed = new SimpleSubrecord <Single>();
                    }

                    TurningSpeed.ReadBinary(reader);
                    break;

                case "BNAM":
                    if (BaseScale == null)
                    {
                        BaseScale = new SimpleSubrecord <Single>();
                    }

                    BaseScale.ReadBinary(reader);
                    break;

                case "WNAM":
                    if (FootWeight == null)
                    {
                        FootWeight = new SimpleSubrecord <Single>();
                    }

                    FootWeight.ReadBinary(reader);
                    break;

                case "NAM4":
                    if (ImpactMaterialType == null)
                    {
                        ImpactMaterialType = new SimpleSubrecord <MaterialTypeUInt>();
                    }

                    ImpactMaterialType.ReadBinary(reader);
                    break;

                case "NAM5":
                    if (SoundLevel == null)
                    {
                        SoundLevel = new SimpleSubrecord <SoundLevel>();
                    }

                    SoundLevel.ReadBinary(reader);
                    break;

                case "CSCR":
                    if (SoundTemplate == null)
                    {
                        SoundTemplate = new RecordReference();
                    }

                    SoundTemplate.ReadBinary(reader);
                    break;

                case "CSDT":
                    if (SoundData == null)
                    {
                        SoundData = new List <CreatureSoundData>();
                    }

                    CreatureSoundData tempCSDT = new CreatureSoundData();
                    tempCSDT.ReadBinary(reader);
                    SoundData.Add(tempCSDT);
                    break;

                case "CNAM":
                    if (ImpactDataset == null)
                    {
                        ImpactDataset = new RecordReference();
                    }

                    ImpactDataset.ReadBinary(reader);
                    break;

                case "LNAM":
                    if (MeleeWeaponList == null)
                    {
                        MeleeWeaponList = new RecordReference();
                    }

                    MeleeWeaponList.ReadBinary(reader);
                    break;

                default:
                    throw new Exception();
                }
            }
        }
Beispiel #23
0
 public static SoundLevels ToSoundLevels(this SoundLevel value)
 {
     return(EnumConverter.ConvertByName <SoundLevels>(value));
 }