예제 #1
0
 //target描述,此特效的主调者
 //timePlayed用于同步动作和特效。快速出招时,特效要加一个已经播放时间,否则特效跟不上动作的播放步骤
 public SFXEffectPlay PlayEffect(string file, CharacterLoader target, float timePlayed = 0.0f)
 {
     if (!EffectList.ContainsKey(file))
     {
         SfxFile f = new SfxFile();
         try
         {
             if (f.ParseFile(file))
             {
                 EffectList.Add(file, f);
                 //Debug.LogError("effect file:" + file);
                 return(f.Play(target, timePlayed));
             }
         }
         catch
         {
             Debug.LogError(file + " parse error");
         }
     }
     else
     {
         //Debug.LogError("effect file:" + file);
         return(EffectList[file].Play(target, timePlayed));
     }
     return(null);
 }
예제 #2
0
 //target描述,此特效的主调者
 //timePlayed用于同步动作和特效。快速出招时,特效要加一个已经播放时间,否则特效跟不上动作的播放步骤
 public SFXEffectPlay PlayEffect(string file, CharacterLoader target, float timePlayed = 0.0f)
 {
     if (!EffectList.ContainsKey(file))
     {
         SfxFile f = new SfxFile();
         try
         {
             f.ParseFile(file);
             EffectList[file] = f;
             //Debug.LogError("effect file:" + file);
             return(f.Play(target, timePlayed));
         }
         catch (Exception exp)
         {
             Debug.LogError(string.Format("{0}  parse error {1}", file, exp.Message));
             EffectList[file] = f;
         }
     }
     else
     {
         //Debug.LogError("effect file:" + file);
         if (EffectList[file].error)
         {
             return(null);
         }
         return(EffectList[file].Play(target, timePlayed));
     }
     return(null);
 }
예제 #3
0
 //一些环境特效,例如风之类的音效.
 public SFXEffectPlay PlayEffect(string file, GameObject obj, bool once = false)
 {
     if (!EffectList.ContainsKey(file))
     {
         SfxFile f = new SfxFile();
         try
         {
             if (f.ParseFile(file))
             {
                 EffectList.Add(file, f);
                 //Debug.LogError("effect file:" + file);
                 return(f.Play(obj, once));
             }
             else
             {
                 Debug.LogError(file + " parse error445");
             }
         }
         catch
         {
             Debug.LogError(file + " parse error449");
         }
     }
     else
     {
         //Debug.LogError("effect file:" + file + " 455");
         return(EffectList[file].Play(obj, once));
     }
     return(null);
 }
예제 #4
0
 //一些环境特效,例如风之类的音效.
 public SFXEffectPlay PlayEffect(string file, GameObject obj, bool once = false, bool preload = false)
 {
     if (!EffectList.ContainsKey(file))
     {
         SfxFile f = new SfxFile();
         try
         {
             f.ParseFile(file);
             EffectList[file] = f;
             if (!f.error)
             {
                 return(f.Play(obj, once, preload));
             }
         }
         catch
         {
             EffectList[file] = f;
             Debug.LogError(string.Format("{0}  parse error", file));
         }
     }
     else
     {
         if (EffectList[file].error)
         {
             return(null);
         }
         //Debug.LogError("effect file:" + file + " 455");
         return(EffectList[file].Play(obj, once, preload));
     }
     return(null);
 }
예제 #5
0
    public SFXEffectPlay PlayEffect(string file, Vector3 position, bool once = false, bool preload = false)
    {
        GameObject obj = new GameObject(file);

        obj.transform.position   = position;
        obj.transform.rotation   = Quaternion.identity;
        obj.transform.localScale = Vector3.one;
        if (!Effect.ContainsKey(file))
        {
            SfxFile f = LoadSfx(file);
            if (f != null)
            {
                return(f.Play(obj, once, preload));
            }
        }
        else
        {
            if (Effect[file].error)
            {
                return(null);
            }
            //Debug.LogError("effect file:" + file + " 455");
            return(Effect[file].Play(obj, once, preload));
        }
        return(null);
    }
예제 #6
0
 //一些环境特效,例如风之类的音效.
 public SFXEffectPlay PlayEffect(string file, GameObject obj, bool once = false, bool preload = false)
 {
     if (!Effect.ContainsKey(file))
     {
         SfxFile f = LoadSfx(file);
         if (f != null)
         {
             return(f.Play(obj, once, preload));
         }
     }
     else
     {
         if (Effect[file].error)
         {
             return(null);
         }
         //Debug.LogError("effect file:" + file + " 455");
         return(Effect[file].Play(obj, once, preload));
     }
     return(null);
 }
예제 #7
0
 //target描述,此特效的主调者
 //timePlayed用于同步动作和特效。快速出招时,特效要加一个已经播放时间,否则特效跟不上动作的播放步骤
 public SFXEffectPlay PlayEffect(string file, MonoBehaviour target, float timePlayed)
 {
     //Debug.Log("timePlayed:" + timePlayed);
     if (!Effect.ContainsKey(file))
     {
         SfxFile f = LoadSfx(file);
         if (f != null)
         {
             return(f.Play(target, timePlayed));
         }
     }
     else
     {
         //Debug.LogError("effect file:" + file);
         if (Effect[file].error)
         {
             return(null);
         }
         return(Effect[file].Play(target, timePlayed));
     }
     return(null);
 }
예제 #8
0
    public SFXEffectPlay PlayEffect(string file, Vector3 position, bool once = false, bool preload = false)
    {
        GameObject obj = new GameObject(file);

        obj.transform.position   = position;
        obj.transform.rotation   = Quaternion.identity;
        obj.transform.localScale = Vector3.one;
        if (!EffectList.ContainsKey(file))
        {
            SfxFile f = new SfxFile();
            try
            {
                f.ParseFile(file);
                EffectList[file] = f;
                if (!f.error)
                {
                    return(f.Play(obj, once, preload));
                }
            }
            catch
            {
                EffectList[file] = f;
                Debug.LogError(string.Format("{0}  parse error", file));
            }
        }
        else
        {
            if (EffectList[file].error)
            {
                return(null);
            }
            //Debug.LogError("effect file:" + file + " 455");
            return(EffectList[file].Play(obj, once, preload));
        }
        return(null);
    }