static int Play(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); CFxOne obj = (CFxOne)LuaScriptMgr.GetUnityObjectSelf(L, 1, "CFxOne"); float arg0 = (float)LuaScriptMgr.GetNumber(L, 2); obj.Play(arg0); return(0); }
private static int PlayEarlyWarningGfx(IntPtr L) { int count = LuaDLL.lua_gettop(L); const int nRet = 2; if (count == 6 && LuaScriptMgr.CheckTypes(L, 1, typeof(string), typeof(LuaTable), typeof(LuaTable), typeof(LuaTable), typeof(float), typeof(bool))) { float lifeTime = (float)LuaScriptMgr.GetNumber(L, 5); if (lifeTime < 0.01f) { LuaDLL.lua_pushnil(L); LuaScriptMgr.Push(L, 0); return(CheckReturnNum(L, count, nRet)); } string gfxName = LuaScriptMgr.GetString(L, 1); int fxId = 0; CFxOne fx = CFxCacheMan.Instance.RequestFxOne(gfxName, -1, out fxId); if (fx == null) { LuaDLL.lua_pushnil(L); LuaScriptMgr.Push(L, 0); return(CheckReturnNum(L, count, nRet)); } Vector3 pos = LuaScriptMgr.GetVector3(L, 2); Vector3 dir = LuaScriptMgr.GetVector3(L, 3); Vector3 scale = LuaScriptMgr.GetVector3(L, 4); bool doNotUseProjector = LuaScriptMgr.GetBoolean(L, 6); Transform trans = fx.transform; trans.position = pos; trans.rotation = CMapUtil.GetMapNormalRotationWithDistance(pos, dir, Math.Max(scale.x, scale.z)); //法线为地面法线 trans.localScale = Vector3.one; fx.IsFixRot = false; if (fx.EarlyWarning == null) { fx.EarlyWarning = new EarlyWarningInfo(); } fx.EarlyWarning.Set(Time.time, lifeTime, scale, doNotUseProjector); fx.Play(lifeTime + 0.2f); LuaScriptMgr.Push(L, fx.gameObject); LuaScriptMgr.Push(L, fx.ID); } else { LogParamError("PlaySkillIndicatorGfx", count); LuaDLL.lua_pushnil(L); LuaScriptMgr.Push(L, 0); } return(CheckReturnNum(L, count, nRet)); }
public void Apply(bool show, GameObject target, float distance, float targetId) { if (show) { if (target == null) { return; } FollowTarget = target; Distance = distance; _TargetId = targetId; var capsuleCollider = target.GetComponentInChildren <CapsuleCollider>(); if (capsuleCollider != null) { var height = capsuleCollider.height / 2; _Radius = capsuleCollider.radius; _Offset.y = height; } else { HobaDebuger.LogWarningFormat("EffectiveModel does not have CapsuleCollider: {0}", target.gameObject.name); var height = 1; _Offset.y = height; } if (_FxOneComp != null) { _FxOneComp.Play(-1); } } else { if (_FxOneComp != null) { _FxOneComp.Stop(); } FollowTarget = null; Distance = 0; } }
public static GameObject PlayFx(Transform hook, Transform anchor, GameObject clipper, string fx_path, float life_time, bool is_ui, int order_offset = 0) { if (!is_ui) { #if ART_USE && UNITY_EDITOR GameObject obj = UnityEditor.AssetDatabase.LoadAssetAtPath(fx_path, typeof(GameObject)) as GameObject; if (obj != null) { obj = Object.Instantiate <GameObject>(obj); Transform t = obj.transform; t.SetParent(hook, false); obj.SetActive(true); Util.SetLayerRecursively(obj, LayerMask.NameToLayer("UIScene")); //re-position if (anchor != null && anchor != hook) { t.position = anchor.position; } if (life_time < 0.0001f) { FxDuration fxd = obj.GetComponent <FxDuration>(); if (fxd != null) { life_time = fxd.duration; } } Object.Destroy(obj, life_time > 0.0001f ? life_time : 5); Debug.Log("PlayFx " + hook.name + ", " + fx_path + ", " + life_time); } return(obj); #else //Debug.Log("TODO: PlayFx"); #if IN_GAME int fxId = 0; CFxOne fxOne = CFxCacheMan.Instance.RequestFxOne(fx_path, -1, out fxId); if (fxOne != null) { Transform t_fx = fxOne.transform; GameObject g_fx = fxOne.gameObject; t_fx.SetParent(hook, false); //re-position if (anchor != null && anchor != hook) { t_fx.position = anchor.position; } //g_fx.SetActive(true); Util.SetLayerRecursively(g_fx, LayerMask.NameToLayer("UIScene")); fxOne.Play(life_time); return(fxOne.gameObject); } return(null); #else return(null); #endif #endif } else { return(UISfxBehaviour.Play(fx_path, anchor.gameObject, hook.gameObject, clipper, life_time, 20, order_offset)); } }