public void PlayWorldEffect(EnumEffectType effectType) { uint effectId = GetEffectId(effectType); if (effectId == 0) { return; } Transform parent = m_Property.GetOwner().GetSkinRootTransform(); Vector3 position = parent.position; Quaternion rotation = parent.rotation; parent = null; string path = m_CfgEternityProxy.GetEffectPath(effectId); EffectController effectController = EffectManager.GetInstance().CreateEffect(path, EffectManager.GetEffectGroupNameInSpace(m_Property.IsMain())); effectController.transform.SetParent(null, false); effectController.transform.localPosition = position; effectController.transform.localRotation = rotation; effectController.SetCreateForMainPlayer(m_Property.IsMain()); effectController.PlayFX(); if (!m_EffectTable.ContainsKey(effectId)) { m_EffectTable.Add(effectId, effectController); } BehaviorManager.Instance.LogFormat(m_Agent, string.Format($"PlayEffect effectType:{effectType} effectId:{effectId} path:{path}")); }
private void OnCreateStartAndLoopFX(EffectController buffFX, System.Object usedata) { if (usedata != null) { Buff buff = (Buff)usedata; if (buff != null) { // buff.VFXList?.Add(buffFX); buff.BuffProperty?.AddVFX(buffFX); if (buff.BuffEffect != null) { buff.BuffEffect.OnLoopFXLoaded(buffFX); } } else { buffFX.RecycleFX(); } } else { buffFX.RecycleFX(); } }
// Start is called before the first frame update void Start() { scheduler.Start(() => { var edges = graph.GetEdges(current.id); Node ret; if (edges.Count == 0) { ret = graph.GetRoot(); } else { if (edges.Count == 1) { ret = graph.GetNode(edges.ElementAt(0)); } else { ret = graph.GetNode(edges.ElementAt(rng.Next(edges.Count))); } } current = ret; EffectController.GetInstance().OnActivateNode(current); return(ret); }); is_playing = true; }
/// <summary> /// 创建开始,循环阶段特效 /// </summary> private void CreateStartFXAndLoopFX() { if (VO.Link_id > 0 && !VO.Is_master) { //连线 buff, 被链接方,不播特效 return; } SkillBuff buffConfig = m_SkillProxy.GetBuff((int)VO.ID); CfgSkillSystemProxy skillProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgSkillSystemProxy) as CfgSkillSystemProxy; if (Leyoutech.Utility.EffectUtility.IsEffectNameValid(buffConfig.StartFx)) { EffectController StartFX = EffectManager.GetInstance().CreateEffect(buffConfig.StartFx, EffectManager.GetEffectGroupNameInSpace(BuffProperty.IsMain())); //StartFX.transform.SetParent(BuffEffect.m_SelfTransform, false); BuffEffect.SetStartEffectController(StartFX); StartFX.SetCreateForMainPlayer(BuffProperty.IsMain()); } if (Leyoutech.Utility.EffectUtility.IsEffectNameValid(buffConfig.LoopFx)) { EffectController LoopFX = EffectManager.GetInstance().CreateEffect(buffConfig.LoopFx, EffectManager.GetEffectGroupNameInSpace(BuffProperty.IsMain()), OnCreateStartAndLoopFX, this); //LoopFX.transform.SetParent(BuffEffect.m_SelfTransform, false); BuffEffect.SetLoopEffectController(LoopFX); LoopFX.SetCreateForMainPlayer(BuffProperty.IsMain()); } }
/// <summary> /// 转化炉的聚气 /// 这是一个纯客户端表现的事. 聚气0.5秒后再按某个键开启转化炉 /// </summary> /// <param name="componentEvent"></param> private void OnBurstPressed(IComponentEvent componentEvent) { ActivateBurstPressedEvent burstReadyEvent = componentEvent as ActivateBurstPressedEvent; if (burstReadyEvent.Ready) { if (m_Presentation != null) { if (m_ReformerReadyFX == null && Leyoutech.Utility.EffectUtility.IsEffectNameValid(m_Presentation.ReformerChargingFXAddress)) { m_ReformerReadyFX = EffectManager.GetInstance().CreateEffect(m_Presentation.ReformerChargingFXAddress, EffectManager.GetEffectGroupNameInSpace(m_Property.IsMain())); m_ReformerReadyFX.transform.SetParent(m_Property.GetSkinRootTransform(), false); m_ReformerReadyFX.SetCreateForMainPlayer(m_Property.IsMain()); m_ReformerReadyFX.SetAutoRecycleWhenNotExistLivingParticles(false); } else { m_ReformerReadyFX.PlayFX(); } } } else { m_ReformerReadyFX?.StopFX(); } }
//create effect public EffectController Create(GfxObject owner, ActionObject.Effect effect, HitData hitData, GfxObject target) { GameObject go = owner.gameObject; GameObject obj = GameObject.Instantiate(Resources.Load("Battle/Effect/" + effect.id)) as GameObject; EffectController effectController = obj.AddComponent <EffectController>(); effectController.time = effect.time; effectController.bullet = effect.bullet; effectController.target = target; effectController.owner = owner; effectController.hitData = hitData; Transform trans = go.gameObject.transform.Find(effect.parent); if (trans != null) { obj.transform.parent = trans; obj.transform.localPosition = effect.offset; obj.transform.localRotation = Quaternion.Euler(effect.rotate); obj.transform.localScale = effect.scale; } if (effect.parent == "null") { obj.transform.parent = go.transform.parent; obj.transform.localPosition = go.transform.localPosition + effect.offset; obj.transform.localRotation = Quaternion.Euler(go.transform.localRotation.eulerAngles + effect.rotate); obj.transform.localScale = effect.scale; } return(effectController); }
private void SynchronizeEffectPropertyToPrefab() { string effectPathFormat = "Assets/Resources/{0}.prefab"; int recordCount = CDataMgr.Effects.GetRecordCount(); for (int i = 0; i < recordCount; ++i) { int id = CDataMgr.Effects.GetDataByNumber <int>(i, 0); ModelEffects modelEffects = new ModelEffects(); modelEffects.LoadConfig(id); string effectPathName = string.Format(effectPathFormat, modelEffects.name_); GameObject effectGameObject = AssetDatabase.LoadAssetAtPath(effectPathName, typeof(GameObject)) as GameObject; if (effectGameObject != null) { EffectController effectController = effectGameObject.GetComponent <EffectController>(); if (effectController == null) { effectController = effectGameObject.AddComponent <EffectController>(); } effectController.bindPosition = modelEffects.bind_pos_; effectController.canBreakOff = modelEffects.can_break_off_; effectController.canHitPause = modelEffects.can_hit_pause_; effectController.effectType = (int)modelEffects.effect_type_; } } }
protected override void OnEffectTick(float delta) { float damageInDelta = damage * delta; GD.Print("Damage sending " + damageInDelta); EffectController.HealthAction((h) => h.TakeDamage(damageInDelta)); }
protected float AddDamageProccess(PlayerStatus status, float dmg, bool isSlip = false) { if (dmg <= 0) { return(0); } //対象へダメージを与える float addDamage = status.AddDamage(dmg, GetWeaponName(), isSlip); //HITエフェクト if (hitEffect != null && !isSlip) { GameObject effectObj = PhotonNetwork.Instantiate(Common.Func.GetResourceEffect(hitEffect.name), myTran.position, hitEffect.transform.rotation, 0); EffectController effectCtrl = effectObj.GetComponent <EffectController>(); if (effectCtrl != null) { effectCtrl.EffectSetting(ownerTran, targetTran, weaponTran, false); } } //与えたダメージのログを保管 if (addDamage > 0 && ownerStatus != null) { ownerStatus.SetBattleLog(PlayerStatus.BATTLE_LOG_ATTACK, addDamage, GetWeaponName(), isSlip); } return(addDamage); }
static public int Remove(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif EffectController self = (EffectController)checkSelf(l); self.Remove(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
protected IEnumerator RespawnPlayerCharacter(PlayerCharacter character) { // play caught animation AnimationEffect animationEffect = GetAnimationEffectForPlayerChaught(); GameObject emmonCaughtPrefab = MazeLevelGameplayManager.Instance.GetEffectAnimationPrefab(animationEffect); GameObject emmonCaughtPGO = GameObject.Instantiate(emmonCaughtPrefab, SceneObjectManager.Instance.transform); Vector3 emmonCaughtSpawnPosition = character.transform.position; emmonCaughtPGO.transform.position = emmonCaughtSpawnPosition; EffectController emmonCaughtPGOEffectController = emmonCaughtPGO.GetComponent <EffectController>(); emmonCaughtPGOEffectController.PlayEffect(animationEffect); character.FreezeCharacter(); CharacterBody.SetActive(false); SetBodyAlpha(0); // make body transparent before respawning ResetCharacterPosition(); float waitTime = 1.4f; yield return(new WaitForSeconds(waitTime)); _animationHandler.TriggerSpawning(); CharacterBody.SetActive(true); float spawnAnimationLength = 0.44f; yield return(new WaitForSeconds(spawnAnimationLength)); character.UnfreezeCharacter(); }
public override void OnLoopFXLoaded(EffectController vfx) { GameplayProxy gameplayProxy = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy; SpacecraftEntity mainPlayer = gameplayProxy.GetMainPlayer(); if (mainPlayer != null) { if (gameplayProxy.CanAttackToTarget(mainPlayer, m_Buff.BuffProperty.GetOwner())) { // 隐身的时候只剩下特效. 如果是敌方隐身, 连特效都看不见了 List <EffectController> vfxList = m_Buff.BuffProperty.GetAllVFXs(); foreach (EffectController iVfx in vfxList) { // HACK. 如果不加这个if判断, 就会把隐身启动的特效一起隐藏掉 // 这里如果要完善这个逻辑, 需要做较多的工作. 我就直接偷个懒了. if (!iVfx.GetEffectObject().AutoStop) { iVfx.StopAndRecycleFX(true); } } m_Buff.BuffProperty.GetPresentation().SetVisibilityOfVFX(false); LayerUtil.SetGameObjectToLayer(m_Buff.BuffProperty.GetSkinRootTransform().gameObject, LayerTypeID.UnselectableSpacecraft, true); } } }
public T CreateEffect <T>(Vector3 position, Quaternion rotation, Transform parent) where T : EffectController { EffectController newEffect = null; for (int i = 0; i < _effectList.Count; i++) { if (_effectList[i].GetType() == typeof(T) && _effectList[i].isFree) { newEffect = _effectList[i]; break; } } if (newEffect == null) { foreach (var prefabEffect in effectsList) { if (null != prefabEffect.gameObject.GetComponent <T>()) { newEffect = Instantiate(prefabEffect, position, Quaternion.identity, null).GetComponent <T>(); break; } } _effectList.Add(newEffect); } newEffect.Init(position, rotation, parent, this); return((T)newEffect); }
static int BindDestroyFunction(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); EffectController obj = (EffectController)ToLua.CheckObject(L, 1, typeof(EffectController)); System.Action arg0 = null; LuaTypes funcType2 = LuaDLL.lua_type(L, 2); if (funcType2 != LuaTypes.LUA_TFUNCTION) { arg0 = (System.Action)ToLua.CheckObject(L, 2, typeof(System.Action)); } else { LuaFunction func = ToLua.ToLuaFunction(L, 2); arg0 = DelegateFactory.CreateDelegate(typeof(System.Action), func) as System.Action; } obj.BindDestroyFunction(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int set_onDestroy(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); EffectController obj = (EffectController)o; System.Action arg0 = null; LuaTypes funcType2 = LuaDLL.lua_type(L, 2); if (funcType2 != LuaTypes.LUA_TFUNCTION) { arg0 = (System.Action)ToLua.CheckObject(L, 2, typeof(System.Action)); } else { LuaFunction func = ToLua.ToLuaFunction(L, 2); arg0 = DelegateFactory.CreateDelegate(typeof(System.Action), func) as System.Action; } obj.onDestroy = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index onDestroy on a nil value" : e.Message)); } }
private void ShowDefaultModel() { Tab_BelleFightShow nowshow = null; Dictionary <int, List <Tab_BelleFightShow> > bfss = TableManager.GetBelleFightShow(); foreach (KeyValuePair <int, List <Tab_BelleFightShow> > pair in bfss) { if (pair.Value != null && pair.Value.Count > 0) { if (nowshow == null) { nowshow = pair.Value[0]; } AllBelleFightShow.Add(pair.Value[0]); if (pair.Value[0].CombatForce < m_CombatAllValue) { ++m_ShowBelleNum; nowshow = pair.Value[0]; } } } if (nowshow != null) { if (BattleNum != null) { BattleNum.text = nowshow.CombatForce.ToString(); } if (EffectController != null) { EffectController.InitEffect(EffectController.gameObject); EffectController.PlayEffect(nowshow.EffectId, PlayEffectOver); } } }
/// <summary> /// 停止所有界面特效,要把回调给清掉 /// </summary> public void StopAllUIEffects() { List <UILayer> layers = new List <UILayer>(); for (int i = 0; i < this.transform.childCount; ++i) { GameObject child = this.transform.GetChild(i).gameObject; UILayer layer = child.GetComponent <UILayer>(); EffectController effectCtrl = child.GetComponent <EffectController>(); if (layer == null) { continue; } if (layer.type != UILayerType.UIEffect) { continue; } effectCtrl.onDestroy = null; layers.Add(layer); } foreach (UILayer layer in layers) { GameObject.Destroy(layer.gameObject); } }
public void GatherInteraction(Vector2Int gridPosition, TileMapLayer tilemapLayer) { if (GetIsGatherable) { EffectController effectController = new EffectController(PlayerStats._instance.GetStat(StatType.EXP), 0); expEffect.duration = currentStage.GetExpReward / expEffect.amount; effectController.Begin(expEffect); Debug.Log("Tried gathering"); if (currentStage.GetDestroyOnGather || currentStageIndex == 0) { Remove(gridPosition, tilemapLayer); } else { currentStageIndex--; if (!reachedMaxStage) { InitEvent(gridPosition, tilemapLayer); } SetIsBeingGatheredState(false, gridPosition); } Inventory inventory = Inventory.GetInstance; foreach (Drop drop in currentStage.GetDrops) { if (Random.value <= drop.GetChance) { inventory.AddToInventory(0, new ItemSlot(drop.GetItem, Random.Range(drop.GetMinAmount, drop.GetMaxAmount + 1))); } } } }
IEnumerator SurvivalEffects() { //Declartion of Effects EffectData hungerEffect = new EffectData(StatType.Food, EffectType.OverTime, -hungerDropAmount, Mathf.Infinity, 1f, false, false); EffectData thirstEffect = new EffectData(StatType.Water, EffectType.OverTime, -WaterDropAmount, Mathf.Infinity, 1f, false, false); EffectData oxygenEffect = new EffectData(StatType.Air, EffectType.OverTime, -airDropAmount, Mathf.Infinity, 1f, false, false); EffectData sleepEffect = new EffectData(StatType.Sleep, EffectType.OverTime, -sleepDropAmount, Mathf.Infinity, 1f, false, false); yield return(new WaitForSeconds(cooldownBeforeStart)); //Applying Effects: EffectController worldEffect; worldEffect = new EffectController(playerStats.GetStat(StatType.Food), 3f); worldEffect.Begin(hungerEffect); worldEffect = new EffectController(playerStats.GetStat(StatType.Water), 3f); worldEffect.Begin(thirstEffect); worldEffect = new EffectController(playerStats.GetStat(StatType.Air), 3f); worldEffect.Begin(oxygenEffect); worldEffect = new EffectController(playerStats.GetStat(StatType.Sleep), 3f); worldEffect.Begin(sleepEffect); }
/// <summary> /// 设置开始特效 /// </summary> /// <param name="starteffct"></param> public override void SetStartEffectController(EffectController starteffct) { base.SetStartEffectController(starteffct); //TODO 下方待补充 //补充链接另一边吧 }
//--------------------------------------------------- // Use this for initialization void Awake() { #if SHOW_DEBUG_MESSAGES Debug.Log("EffectControllerを実行"); #endif // sceneにinstanceが存在するかを検査 // 存在する場合消滅させる。 if (instance) { DestroyImmediate(gameObject); return; } // このinstanceを唯一のobjectにする。 instance = this; // Effectをarrayにセーブする List <GameObject> particleExampleList = new List <GameObject>(); int nbChild = this.transform.childCount; for (int i = 0; i < nbChild; i++) { GameObject child = this.transform.GetChild(i).gameObject; particleExampleList.Add(child); } particleExampleList.Sort(delegate(GameObject o1, GameObject o2) { return(o1.name.CompareTo(o2.name)); }); ParticleExamples = particleExampleList.ToArray(); StartCoroutine("CheckForDeletedParticles"); }
/// <summary> /// 设置结束特效 /// </summary> /// <param name="endeffct"></param> public override void SetEndEffectController(EffectController endeffct) { base.SetEndEffectController(endeffct); //TODO 下方待补充 //补充链接另一边吧 }
/// <summary> /// 设置循环特效 /// </summary> /// <param name="loopeffct"></param> public override void SetLoopEffectController(EffectController loopeffct) { base.SetLoopEffectController(loopeffct); //TODO 下方待补充 //补充链接另一边吧 }
public void RightClick() { if (EffectController != null) { //EffectController.ClearEffect(); GameObject go = null; if (EffectGODic.TryGetValue(m_ShowBelleNum, out go)) { if (go != null && m_ShowBelleNum < (AllBelleFightShow.Count - 1)) { go.SetActive(false); } } if (m_ShowBelleNum < (AllBelleFightShow.Count - 1)) { ++m_ShowBelleNum; if (BattleNum != null && AllBelleFightShow.Count > m_ShowBelleNum && AllBelleFightShow[m_ShowBelleNum] != null) { BattleNum.text = AllBelleFightShow[m_ShowBelleNum].CombatForce.ToString(); } if (EffectGODic.TryGetValue(m_ShowBelleNum, out go)) { if (go != null) { go.SetActive(true); return; } } if (AllBelleFightShow.Count > m_ShowBelleNum && AllBelleFightShow[m_ShowBelleNum] != null) { EffectController.PlayEffect(AllBelleFightShow[m_ShowBelleNum].EffectId, PlayEffectOver); } } } }
/// <summary> /// 加载特效Prefab /// </summary> private void LoadEffect() { uint reloadID = m_ReloadID; string path = m_EffectPath; EffectArray = new EffectController[ModelArray.Length]; for (int i = 0; i < ModelArray.Length; i++) { GameObject model = ModelArray[i]; if (model) { EffectController effectController = EffectManager.GetInstance().CreateEffect(m_EffectPath, EffectManager.GetEffectGroupNameInSpace(true), (effect, usedata) => { Effect3DViewer viewer = (Effect3DViewer)usedata; if (viewer != null) { if (reloadID != viewer.m_ReloadID) { return; } if (viewer.m_LightEnvirontment == null) { return; } if (viewer.ModelArray == null) { return; } if (!path.Equals(viewer.m_EffectPath)) { return; } viewer.InstallModelAndEffect(); effect.PlayFX(); //加载完特效再显示 } } , this); if (ModelArray != null) { effectController.transform.SetParent(model.transform, false); effectController.SetCreateForMainPlayer(true); effectController.StopFX(true); //特效未加载完不显示 } else { effectController.StopFX(true); } EffectArray[i] = effectController; } else { EffectArray[i] = null; } } }
private void RemoveGatherFx() { if (m_StayFxInstance != null) { m_StayFxInstance.StopFX(); m_StayFxInstance = null; } }
/// <summary> /// 修改连接 特效的 目标位置 /// </summary> /// <param name="targetPos">特效连接点</param> internal static void ChangeLinkEffectTarget(EffectController effect, Vector3 targetPos) { if (effect == null) { return; } effect.SetBeamTarget(effect.transform.parent, targetPos); }
/// <summary> /// 修改连接 特效的 目标位置 /// </summary> /// <param name="targetTransfrom">特效连接单位</param> /// <param name="offset">于特效连接单位中心位置的偏移</param> internal static void ChangeLinkEffectTarget(EffectController effect, Transform targetTransfrom, Vector3 offset) { if (effect == null) { return; } effect.SetBeamTarget(effect.transform.parent, targetTransfrom, offset /*Vector3.zero*/); }
internal static EffectController CreateEffect(string effectAddress, Transform parentTransfrom, bool isMain, Vector3 targetPos) { EffectController effect = CreateEffect(effectAddress, parentTransfrom, isMain); effect.SetBeamTarget(parentTransfrom, targetPos); return(effect); }
internal static EffectController CreateEffect(string effectAddress, Transform parentTransfrom, bool isMain, Transform targetTransfrom, Vector3 offset) { EffectController effect = CreateEffect(effectAddress, parentTransfrom, isMain); effect.SetBeamTarget(parentTransfrom, targetTransfrom, offset /*Vector3.zero*/); return(effect); }
public override void UseAbility(Node n) { base.UseAbility (n); createdEffects = false; Vector3 pos = map.TileCoordToWorldCoord (myCaster.tileX, myCaster.tileY); myVisualEffects.Add (effectLib.CreateVisualEffect ("Dash", pos, false, false).GetComponent<EffectController> ()); pos = map.TileCoordToWorldCoord (n.x, n.y); wwEffect = effectLib.CreateVisualEffect ("Whirlwind", pos).GetComponent<EffectController> (); myVisualEffects.Add (wwEffect); //change the position of the caster and clear old node map.GetNode (myCaster.tileX, myCaster.tileY).myUnit = null; myCaster.tileX = n.x; myCaster.tileY = n.y; n.myUnit = myCaster; myCaster.transform.position = pos; }
private void Initialize() { if (effectController != null) { return; } var warningClone = Instantiate(EffectPrefab) as GameObject; warningClone.transform.position = transform.position; warningClone.transform.parent = transform; warningClone.transform.localScale = Vector3.one; var renderQueue = warningClone.GetComponent<SetRenderQueue>() ?? warningClone.AddComponent<SetRenderQueue>(); renderQueue.RenderQueue = RenderQueue; effectController = warningClone.GetComponent<EffectController>() ?? warningClone.AddComponent<EffectController>(); effectController.gameObject.SetActive(false); }
/// <summary> /// This is a animation or particle system play. /// </summary> /// <param name="loop">flag to loop move or not</param> /// <param name="pos">effect play position</param> public void EffectPlay(bool loop, Vector3 pos) { IsLoop = loop; moveTraceList.Clear(); moveTraceList.Add(pos); CurrentObject.SetActive(true); CurrentObject.transform.position = moveTraceList[0]; ////Set render queue for display correct. //var setRenderQueue = CurrentObject.GetComponent<SetRenderQueue>() ?? // CurrentObject.AddComponent<SetRenderQueue>(); //setRenderQueue.RenderQueue = RenderQueue.ToppestEffect; //Play animation or particle system. effectController = CurrentObject.GetComponent<EffectController>(); effectController.Play(true); }
private void PlayEffect(EffectController effectController) { NGUITools.SetActive(effectController.gameObject, true); effectController.Play(true); }