protected override void ReadData(ESPReader reader)
 {
     using (MemoryStream stream = new MemoryStream(reader.ReadBytes(size)))
         using (ESPReader subReader = new ESPReader(stream, reader.Plugin))
         {
             try
             {
                 MagicEffectFlags = subReader.ReadEnum <MagicEffectFlags>();
                 BaseCost         = subReader.ReadSingle();
                 AssociatedItem.ReadBinary(subReader);
                 MagicSchool    = subReader.ReadEnum <MagicSchool>();
                 ResistanceType = subReader.ReadEnum <ActorValues>();
                 Unknown        = subReader.ReadUInt16();
                 Unused         = subReader.ReadBytes(2);
                 Light.ReadBinary(subReader);
                 ProjectileSpeed = subReader.ReadSingle();
                 EffectShader.ReadBinary(subReader);
                 ObjectDisplayShader.ReadBinary(subReader);
                 EffectSound.ReadBinary(subReader);
                 BoltSound.ReadBinary(subReader);
                 HitSound.ReadBinary(subReader);
                 AreaSound.ReadBinary(subReader);
                 ConstantEffectEnchantmentFactor = subReader.ReadSingle();
                 ConstantEffectBarterFactor      = subReader.ReadSingle();
                 Archetype  = subReader.ReadEnum <MagicEffectArchetype>();
                 ActorValue = subReader.ReadEnum <ActorValues>();
             }
             catch
             {
                 return;
             }
         }
 }
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

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

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

            ele.TryPathTo("AssociatedItem", true, out subEle);
            AssociatedItem.WriteXML(subEle, master);

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

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

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

            WriteUnusedXML(ele, master);

            ele.TryPathTo("Light", true, out subEle);
            Light.WriteXML(subEle, master);

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

            ele.TryPathTo("EffectShader", true, out subEle);
            EffectShader.WriteXML(subEle, master);

            ele.TryPathTo("ObjectDisplayShader", true, out subEle);
            ObjectDisplayShader.WriteXML(subEle, master);

            ele.TryPathTo("EffectSound", true, out subEle);
            EffectSound.WriteXML(subEle, master);

            ele.TryPathTo("BoltSound", true, out subEle);
            BoltSound.WriteXML(subEle, master);

            ele.TryPathTo("HitSound", true, out subEle);
            HitSound.WriteXML(subEle, master);

            ele.TryPathTo("AreaSound", true, out subEle);
            AreaSound.WriteXML(subEle, master);

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

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

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

            ele.TryPathTo("ActorValue", true, out subEle);
            subEle.Value = ActorValue.ToString();
        }
 protected override void WriteData(ESPWriter writer)
 {
     writer.Write((UInt32)MagicEffectFlags);
     writer.Write(BaseCost);
     AssociatedItem.WriteBinary(writer);
     writer.Write((Int32)MagicSchool);
     writer.Write((Int32)ResistanceType);
     writer.Write(Unknown);
     if (Unused == null)
     {
         writer.Write(new byte[2]);
     }
     else
     {
         writer.Write(Unused);
     }
     Light.WriteBinary(writer);
     writer.Write(ProjectileSpeed);
     EffectShader.WriteBinary(writer);
     ObjectDisplayShader.WriteBinary(writer);
     EffectSound.WriteBinary(writer);
     BoltSound.WriteBinary(writer);
     HitSound.WriteBinary(writer);
     AreaSound.WriteBinary(writer);
     writer.Write(ConstantEffectEnchantmentFactor);
     writer.Write(ConstantEffectBarterFactor);
     writer.Write((UInt32)Archetype);
     writer.Write((Int32)ActorValue);
 }
Пример #4
0
    public void SetSound(EffectSound effSound)
    {
        sound = effSound;

        AudioSource.clip   = sound.AudioClip;
        AudioSource.volume = sound.DefaultVolume;
        AudioSource.pitch  = sound.Pitch;
    }
Пример #5
0
 public void Init()
 {
     DelRes();
     ds = new Microsoft.DirectX.DirectSound.Device();
     ds.SetCooperativeLevel(form, CooperativeLevel.Normal);
     secBufferEffs = new EffectSound[effLen];
     for (int i = 0; i < effLen; i++)
     {
         secBufferEffs[i] = new EffectSound();
     }
     //*/
 }
Пример #6
0
    public void AddEffectSoundTo(GameObject go, string effectName)
    {
        EffectSound sound = Array.Find(EffectSounds, s => s.Name == effectName);

        if (sound != null)
        {
            EffectSource source = go.AddComponentNotExist <EffectSource>();

            source.SetSound(sound);
            source.SetVolume(EffectVolume);
            EffectSoundsCatcher.Add(source);
        }
    }
Пример #7
0
    /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~其他~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
    /// <summary>
    /// 忽视距离声音
    /// </summary>
    public SoundBase PlayIgnoreListenerSound(string fileName, int count = 1)
    {
        if (IsCloseEffectSound || fileName.Length == 0)
        {
            return(null);
        }

        EffectSound sound = CommonObjectPools.Spawn <EffectSound>();

        sound.Setup(fileName, Vector3.zero, GetDefaultListener().transform, 0, 500, count);
        sound.LoadResource();

        return(sound);
    }
Пример #8
0
    /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~音效~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
    /// <summary>
    /// 音效
    /// </summary>
    /// <param name="fileName">资源文件</param>
    /// <param name="pos">播放位置</param>
    /// <param name="loop">是否循环:如果是循环音效,需要手动清理(AudioSourcePools.instance.DespawnAudio)</param>
    /// <returns></returns>
    public SoundBase PlaySoundEffect(string fileName, Vector3 pos, float min_distance, float max_distance, int count = 1)
    {
        if (IsCloseEffectSound || fileName.Length == 0)
        {
            return(null);
        }

        EffectSound sound = CommonObjectPools.Spawn <EffectSound>();

        sound.Setup(fileName, pos, null, min_distance, max_distance, count);
        sound.LoadResource();

        return(sound);
    }
Пример #9
0
    public void PlayEffectSound(EffectSound effect, float delay, Transform parent)
    {
        if (_EffectSoundOn)
        {
            _EffectSoundList[_NowEffectSoundNum].gameObject.SetActive(true);
            _EffectSoundList[_NowEffectSoundNum].Using(_EffectSoundDictionary[effect], delay, parent);

            _NowEffectSoundNum++;
            if (_NowEffectSoundNum >= _MaxEffectSoundNum)
            {
                _NowEffectSoundNum = 0;
            }
        }
    }
Пример #10
0
    public void Init()
    {
        createCount  = 0;
        addClipCount = 0;
        for (int i = 0; i < 7; i++)
        {
            EffectSound clone = EffectSound.Instantiate(esd_prefab);
            clone.name = "EffectSound" + i.ToString();
            esd.Add(clone);

            esd[i].transform.parent   = transform;
            esd[i].transform.position = new Vector2(InitPos.x, InitPos.y - (0.343f * 2 * i));
            createCount++;
        }
    }
Пример #11
0
        public void EffectPlay(EffectSound effectSound, float volume = 1f, bool isLoop = false)
        {
            if (!GameDataMgr.G.isEffect || EffectClips.Length <= 0 || EffectClips.Length <= (int)effectSound)
            {
                return;
            }

            time = RealTime.time;
            if (sourceBgm.clip == EffectClips[(int)effectSound] && mLastTimestamp + 0.1f > time)
            {
                return;
            }
            mLastTimestamp = time;

            sourceEffect.clip   = EffectClips[(int)effectSound];
            sourceEffect.loop   = isLoop;
            sourceEffect.volume = volume;
            sourceEffect.Play();
        }
Пример #12
0
        public void GameEffectPlay(EffectSound effectSound, float volume = 1f, bool isLoop = false)
        {
            if (!GameDataMgr.G.isEffect || EffectClips.Length <= 0 || EffectClips.Length <= (int)effectSound)
            {
                return;
            }

            AudioSource tmpAudio = GetGameEffect();

            if (tmpAudio == null)
            {
                return;
            }

            tmpAudio.clip   = EffectClips[(int)effectSound];
            tmpAudio.loop   = isLoop;
            tmpAudio.volume = volume;
            tmpAudio.Play();
        }
Пример #13
0
    void Start()
    {
        save_Load  = FindObjectOfType <Save_Load>();
        EfSound    = FindObjectOfType <EffectSound>();
        rigidbody_ = GetComponent <Rigidbody>();
        P_collider = GetComponent <CapsuleCollider>();

        save_Load.CallLoad();

        EffectObj[0].SetActive(false);
        EffectObj[1].SetActive(false);
        EffectObj[2].SetActive(false);
        EffectObj[3].SetActive(false);

        speed        = DataOfThisApplication.Instance.minSpeed;
        maxSpeed     = DataOfThisApplication.Instance.maxSpeed;
        acceleration = DataOfThisApplication.Instance.acceleration;

        maxHealth    = DataOfThisApplication.Instance.maxHealth;
        regeneration = DataOfThisApplication.Instance.regeneration;
        health       = maxHealth;

        score_ = 0;

        currentTerrian = 0;
        isIcy          = false;
        DataOfThisApplication.Instance.isRevive    = false;
        DataOfThisApplication.Instance.isGameRun   = true;
        DataOfThisApplication.Instance.isGameStart = false;
        DataOfThisApplication.Instance.isSpeedUp   = false;

        Score.text  = score_.ToString();
        Money.text  = DataOfThisApplication.Instance.Money.ToString();
        Money2.text = DataOfThisApplication.Instance.Money.ToString();

        anim = GetComponent <Animator>();
        anim.SetBool("isDead", false);
        anim.SetBool("isGameStart", false);

        NonGameUI.SetActive(false);
        InGameUI.SetActive(false);
    }
Пример #14
0
    public void SetClip(AudioClip _clip)
    {
        for (int i = 0; i < esd.Count; i++)
        {
            if (esd[i].audioClip != null)
            {
                if (esd[esd.Count - 1].audioClip != null)
                {
                    EffectSound clone = EffectSound.Instantiate(esd_prefab);
                    clone.name               = "EffectSound" + esd.Count.ToString();
                    clone.transform.parent   = transform;
                    clone.transform.position = new Vector2(InitPos.x, InitPos.y - (0.343f * 2 * esd.Count));
                    clone.audioClip          = _clip;
                    clone.text_name.text     = _clip.name;
                    clone.fileURL            = fileURL;
                    esd.Add(clone);
                    createCount++;
                    addClipCount++;
                    break;
                }

                else
                {
                    continue;
                }
            }

            else
            {
                esd[i].audioClip      = _clip;
                esd[i].fileURL        = fileURL;
                esd[i].text_name.text = _clip.name;
                addClipCount++;
                break;
            }
        }
    }
        protected override void ReadDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

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

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

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

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

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

            if (ele.TryPathTo("Unknown", false, out subEle))
            {
                Unknown = subEle.ToUInt16();
            }

            ReadUnusedXML(ele, master);

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

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

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

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

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

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

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

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

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

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

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

            if (ele.TryPathTo("ActorValue", false, out subEle))
            {
                ActorValue = subEle.ToEnum <ActorValues>();
            }
        }
Пример #16
0
    public void PlayEffectSound(EffectSound effect, float delay)
    {
        Transform parent = _Parent;

        PlayEffectSound(effect, delay, parent);
    }
Пример #17
0
 public void PlayEffectSound(int effectID)
 {
     EffectSound.PlayOneShot(EffectClip[effectID]);
 }