public void Destroy() { if (m_Prop != null) { m_Prop = null; } SortedDictionary <float, List <EffectNode> > .Enumerator iter = m_EffectNodes.GetEnumerator(); while (iter.MoveNext()) { for (int i = 0; i < iter.Current.Value.Count; ++i) { if (iter.Current.Value[i] == null) { continue; } iter.Current.Value[i] = null; } iter.Current.Value.Clear(); foreach (var node in iter.Current.Value) { FreeSkillNode(node); } } m_EffectNodes.Clear(); m_Atttacker = null; }
public override void Play(ISkillAttacker attacker, SkillEffect se) { AttachFxNodeProp prop = m_NodeProp as AttachFxNodeProp; if (prop == null) { return; } int level = 0; if (attacker != null) { if (attacker.GetSkillPart() != null) { level = attacker.GetSkillPart().FxLevel; } } skillMaster = attacker.GetGameObject(); AddLinkEffect node = new AddLinkEffect(); node.nFollowType = (int)0; node.rotate = Vector3.zero; node.vOffset = prop.offset_pos; node.nLevel = level; // string effectName = prop.fx_name.Replace( "prefab" , "fx" ); // node.strEffectName = SkillEffectHelper.FxDir + effectName; node.strEffectName = prop.fx_name; node.strLinkName = prop.attach_name; if (skillMaster != null) { effectID = (uint)(int)skillMaster.SendMessage(EntityMessage.EntityCommand_AddLinkEffect, node); } }
public void DestroyFx() { if (rs == null) { rs = Engine.RareEngine.Instance().GetRenderSystem(); } // transform.DetachChildren(); Engine.IEffect effect = rs.GetEffect(m_effectid); if (effect != null) { rs.RemoveEffect(effect); } if (m_hitNode != null) { FollowFxNode node = m_hitNode as FollowFxNode; if (node != null) { node.FreeToNodePool(); } } //m_effectid = 0; m_skillId = 0; m_attacker = null; m_targetObj = null; m_SkillTarget = null; // SkillEffectHelper.Instance.FreeFollowGameObject(gameObject); bDestory = true; bStart = false; // DestroyImmediate(gameObject); }
//public override string Name { get { return "位置变换"; } } //public override void Read(JsonData jsNode) //{ // base.Read(jsNode); // speed = jsNode.GetFloat("speed", 15.0f); // dist = jsNode.GetFloat("dist", 3.0f); // angle = jsNode.GetFloat("angle", 0.0f); // time_len = jsNode.GetFloat("time_len", 0.2f); //} //public override void Write(JsonData jsNode) //{ // base.Write(jsNode); // jsNode["speed"] = speed; // jsNode["dist"] = dist; // jsNode["angle"] = angle; // jsNode["time_len"] = time_len; //} public override void Play(ISkillAttacker attacker, SkillEffect se) { //player.animation.CrossFade(name, 0.2); // caster.SendMessage("OnStartSkillMove", this); attacker.OnStartSkillMove(this); }
public override void Play(ISkillAttacker attacker, SkillEffect se) { if (attacker == null) { return; } IEntity en = attacker.GetGameObject(); if (en == null) { return; } if (!SkillSystem.GetClientGlobal().IsMainPlayer(en)) {//不是主角不震屏 return; } ShakeCameraNodeProp prop = m_NodeProp as ShakeCameraNodeProp; if (prop == null) { return; } IRenderSystem renderSys = RareEngine.Instance().GetRenderSystem(); if (renderSys == null) { Log.Error("RenderSystem is null!"); return; } string camName = "MainCamera"; ICamera cam = renderSys.GetCamera(ref camName); if (cam != null) { ICameraCtrl cc = cam.GetCameraCtrl(); if (cc != null) { // public float duration = 0.2f;//持续时间 // public float strength = 0.5f;//振幅 // public int vibrato = 10;//频率 //@brief 开始振动 //@param fAmplitude 振幅 //@param fFrequency 频率 //@param fCycle 周期 //@param fTime 持续时间 cc.StartShake(prop.strength, prop.vibrato, 1, prop.duration); } } else { //编辑器代码实现 Camera.main.DOShakePosition(prop.duration, prop.strength, prop.vibrato, 0); } }
public override void Play(ISkillAttacker attacker, SkillEffect se) { //player.animation.CrossFade(name, 0.2); //通知释法者,计算伤害 //Debug.Log("OnComputeDamage hit "); //caster.SendMessage("OnComputeDamage", id, SendMessageOptions.DontRequireReceiver); //skill_id = attacker.GetCurSkillId(); skill_id = se.CurSkillID; m_uDamageID = attacker.GetDamageID(); attacker.OnComputeHit(this); }
public override void Play(ISkillAttacker attacker, SkillEffect se) { ScaleTimeNodeProp prop = m_NodeProp as ScaleTimeNodeProp; if (prop == null) { return; } // 不建议使用直接修改 timeScale的方法 Time.timeScale = prop.scale; }
public override void Play(ISkillAttacker attacker, SkillEffect se) { m_ef = se; SoundNodeProp prop = m_NodeProp as SoundNodeProp; if (prop == null) { return; } m_NodeProp.only_main_role = true; if (prop.snd_name == "") { return; } bLoop = prop.bloop; m_fAudioEndTime = prop.endTime; Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio(); if (audio == null) { return; } if (attacker == null) { Log.LogGroup("ZDY", "attacker is null"); return; } if (attacker.GetGameObject() == null) { Log.LogGroup("ZDY", "entity is null"); return; } if (attacker.GetGameObject().GetNode() == null) { Log.LogGroup("ZDY", "entity GetNode is null"); return; } Transform trans = attacker.GetGameObject().GetTransForm(); if (trans == null) { Log.LogGroup("ZDY", "entity GetNode GetTransForm is null"); return; } m_audioID = audio.PlayEffect(trans.gameObject, prop.snd_name, bLoop); uint stopTime = (uint)(m_fAudioEndTime * 1000); if (bLoop) { TimerAxis.Instance().SetTimer(m_uAuidoStopTimerID, stopTime, this, 1); } }
public void SetPlayEffectInitPos(ISkillAttacker attacker) { if (attacker != null) { m_InitPlayEffectPos = attacker.GetTargetPos(); if (m_InitPlayEffectPos == Vector3.zero) { if (attacker.GetRoot() != null) { m_InitPlayEffectPos = attacker.GetRoot().localPosition; } } } }
public override void Play(ISkillAttacker attacker, SkillEffect se) { m_ef = se; ActionNodeProp prop = m_NodeProp as ActionNodeProp; if (prop != null) { m_attacker = attacker; if (attacker != null) { attacker.PlaySkillAnim(prop.name, prop.IsAttackSatte, prop.loopCount, prop.speed, prop.offset); } } }
public void Play(ISkillAttacker attacker) { m_fCurrentTime = 0.0f; m_Atttacker = attacker; m_bAlive = true; bStop = false; bPlayFinish = false; SetPlayEffectInitPos(attacker); CurSkillID = attacker.GetCurSkillId(); table.SkillDatabase db = GameTableManager.Instance.GetTableItem <table.SkillDatabase>(CurSkillID, 1); if (db != null) { m_uSkillLen = db.skillLength; } }
public override void Play(ISkillAttacker attacker, SkillEffect se) { m_ef = se; GameObject go = attacker.GetTargetGameObject(); if (go == null) { return; } FollowFxNodeProp prop = m_NodeProp as FollowFxNodeProp; if (prop == null) { return; } skill_id = se.CurSkillID; m_uDamageID = attacker.GetDamageID(); Transform attacker_node = attacker.GetRoot(); if (attacker_node == null) { return; } //GameObject fxObj = SkillEffectHelper.Instance.GetFollowGameObject(); //if (fxObj == null) //{ // Engine.Utility.Log.Error("============================fxobj is null"); // return; //} //fxObj.transform.parent = SkillEffectManager.Helper.PlaceFxRoot; //EffectUtil.ResetLocalTransform(fxObj.transform); //fxObj.transform.localEulerAngles = attacker_node.eulerAngles; //fxObj.transform.position = attacker_node.position; //fxObj.transform.Translate(prop.offset_pos); int level = 0; if (attacker != null) { if (attacker.GetSkillPart() != null) { level = attacker.GetSkillPart().FxLevel; } } uint effectid = helper.ReqPlayFx(prop.fx_name, helper.PlaceFxRoot, Vector3.zero, Vector3.one, level); IEffect ef = GetEffectByID(effectid); if (ef != null) { if (ef.GetNodeTransForm() == null) { return; } GameObject fxObj = ef.GetNodeTransForm().gameObject; if (fxObj == null) { return; } fxObj.transform.localEulerAngles = attacker_node.eulerAngles; fxObj.transform.position = attacker_node.position; fxObj.transform.Translate(prop.offset_pos); m_Handler = fxObj.GetComponent <FollowFxHandle>(); if (m_Handler == null) { m_Handler = fxObj.AddComponent <FollowFxHandle>(); } m_Handler.m_attacker = attacker; m_Handler.m_speed = prop.speed; m_Handler.targetHitNode = prop.target_hitnode; m_Handler.m_acce = prop.acce; m_Handler.m_len = prop.len; m_Handler.m_hitIndex = hit_index; m_Handler.m_hitNode = this; m_Handler.m_effectid = effectid; m_Handler.InitFollowFx(); } // fxObj.name = m_Handler.m_effectid.ToString(); }
public override void Play(ISkillAttacker attacker, SkillEffect se) { m_ef = se; GameObject fxObj = new GameObject();//helper.CreateFxObj(fx_name); if (fxObj == null) { //Log.Error("no fx: {0}", fx_name); return; } Transform attacker_root = attacker.GetRoot(); //callback.OnTriggerHit(); //ArrowFxHandle handler = Util.AddComponent(fxObj, "ArrowFxHandle") as ArrowFxHandle; m_Handler = fxObj.AddComponent <ArrowFxHandle>(); ArrowFxNodeProp prop = m_NodeProp as ArrowFxNodeProp; if (prop == null) { return; } m_Handler.m_attacker = attacker; m_Handler.m_speed = prop.speed; m_Handler.m_acce = prop.acce; m_Handler.m_range = prop.range; m_Handler.m_radius = prop.radius; m_Handler.m_hitIndex = hit_index; m_Handler.m_hitNode = this; m_Handler.m_hitNum = prop.fx_num; //handler.transform.localPosition = attacker_obj.transform.position; Vector3 scale; scale.x = m_Handler.transform.localScale.x * attacker_root.localScale.x; scale.y = m_Handler.transform.localScale.y * attacker_root.localScale.y; scale.z = m_Handler.transform.localScale.z * attacker_root.localScale.z; m_Handler.transform.localScale = scale; //handler.transform.localPosition += handler.transform.forward * z_offset; //handler.transform.localRotation = caster.transform.rotation; //handler.transform.Rotate(Vector3.forward, pitch, Space.Self); if (prop.fx_num == 1) { m_Handler.transform.parent = SkillEffectManager.Helper.PlaceFxRoot; Vector3 angles = attacker_root.eulerAngles; angles.z = prop.pitch; m_Handler.transform.localEulerAngles = angles; m_Handler.transform.Translate(0, prop.height, prop.z_offset); return; } float start_angle = -prop.angle / 2; float per_angle = prop.angle / (prop.fx_num - 1); for (int i = 0; i < prop.fx_num; i++) { GameObject fxObjInst; if (i == 0) { fxObjInst = fxObj; } else { fxObjInst = new GameObject();//GameObject.Instantiate(fxObj) as GameObject; } m_Handler = fxObjInst.GetComponent <ArrowFxHandle>(); m_Handler.m_attacker = attacker; m_Handler.m_speed = prop.speed; m_Handler.m_acce = prop.acce; m_Handler.m_range = prop.range; m_Handler.m_radius = prop.radius; m_Handler.m_hitIndex = hit_index; m_Handler.m_hitNode = this; m_Handler.m_hitNum = prop.fx_num; fxObjInst.transform.parent = SkillEffectManager.Helper.PlaceFxRoot; Vector3 euler = attacker_root.eulerAngles; euler.y += start_angle; euler.z = prop.pitch; fxObjInst.transform.localEulerAngles = euler; fxObjInst.transform.localScale = scale; fxObjInst.transform.localPosition = attacker_root.position; fxObjInst.transform.Translate(0, prop.height, prop.z_offset); start_angle += per_angle; int level = 0; if (attacker != null) { if (attacker.GetSkillPart() != null) { level = attacker.GetSkillPart().FxLevel; } } m_Handler.m_effectid = helper.ReqPlayFx(prop.fx_name, fxObjInst.transform, Vector3.zero, Vector3.one, level); } }
public void Init(ISkillAttacker attacker) { m_attacker = attacker; }
public override void Play(ISkillAttacker attacker, SkillEffect se) { m_ef = se; Transform attacker_node = attacker.GetRoot(); if (attacker_node == null) { return; } PlaceFxNodeProp prop = m_NodeProp as PlaceFxNodeProp; if (prop == null) { return; } // Engine.Utility.Log.Error("play PlaceFxNodeProp {0}", prop.fx_name); string stateName = prop.nodeState; int stateIndex = 0; if (!string.IsNullOrEmpty(stateName)) { Client.SkillState state = SkillSystem.GetSkillStateByString(stateName); stateIndex = (int)state - 1; } if (stateIndex < 0) { stateIndex = 0; } Vector3 pos = attacker_node.TransformPoint(prop.position); //Vector3 vscale = attacker_node.localScale * prop.scale; Vector3 vscale = Vector3.one * prop.scale; Vector3 angles = attacker_node.eulerAngles; angles += prop.rotation; if (prop.by_target) { pos = se.GetPlayEffectInitPos() + prop.position; } int level = 0; if (attacker != null) { if (attacker.GetSkillPart() != null) { level = attacker.GetSkillPart().FxLevel; } } m_uEffectID = helper.ReqPlayFx(prop.fx_name, pos, angles, vscale, level); m_startTime = Time.time; uint skillID = se.CurSkillID; m_curDb = GameTableManager.Instance.GetTableItem <table.SkillDatabase>(skillID, 1); if (m_curDb != null) { if (stateIndex >= 0) { if (!string.IsNullOrEmpty(m_curDb.skillEffectTime)) { string[] timeArray = SkillSystem.GetTimeArrayByString(m_curDb.skillEffectTime); if (stateIndex < timeArray.Length) { uint time = 1000; if (uint.TryParse(timeArray[stateIndex], out time)) { m_uEffectLen = time; } } } } } // m_bRmove = false; IEffect ef = GetEffectByID(m_uEffectID); if (ef != null) { Transform trans = ef.GetNodeTransForm(); if (trans == null) { return; } m_placeHandle = trans.gameObject.GetComponent <PlaceFxHandle>(); if (m_placeHandle == null) { m_placeHandle = trans.gameObject.AddComponent <PlaceFxHandle>(); } } m_placeHandle.m_attacker = attacker; m_placeHandle.m_len = m_uEffectLen; m_placeHandle.m_effectid = m_uEffectID; m_placeHandle.m_placeNode = this; m_placeHandle.InitPlaceFx(); }
public virtual void Play(ISkillAttacker attacker, SkillEffect effect) { }
public override void Play(ISkillAttacker attacker, SkillEffect se) { }
public override void Play(ISkillAttacker attacker, SkillEffect se) { GameObject damage_obj = new GameObject("damage_obj"); MultHitNodeProp prop = m_NodeProp as MultHitNodeProp; if (prop == null) { return; } if (prop.attach) { damage_obj.transform.parent = attacker.GetRoot(); } else { damage_obj.transform.parent = helper.PlaceFxRoot; } EffectUtil.ResetLocalTransform(damage_obj.transform); damage_obj.transform.localPosition = prop.position; MultHitHandle handle = damage_obj.AddComponent <MultHitHandle>(); handle.m_attacker = attacker; //handle.m_damageRaduis = radius; handle.m_hitTimes = prop.hit_times; handle.m_deltaTime = prop.delta_time; // if (follow == false) // { // damage_obj.transform.parent = Util.PlaceFxRoot; // if (callback == null || by_target == false) // damage_obj.transform.localPosition = caster.transform.TransformPoint(position);//caster.transform.position + position; // else // damage_obj.transform.localPosition = callback.GetAttackTarget().transform.position; // } // else // { // damage_obj.transform.parent = caster.transform; // Util.ResetLocalTransform(damage_obj.transform); // damage_obj.transform.localPosition = position; // } //// Debug.LogWarning(caster); // PlaceDamageHandle handler = damage_obj.AddComponent<PlaceDamageHandle>(); // handler.m_Owner = caster; // handler.m_timeLen = time_len; // handler.m_deltaTime = delta_time; // handler.m_damageRaduis = radius; // handler.m_push = push; // handler.m_hitIndex = hit_index; // handler.m_hitNode = this; // handler.m_callback = callback; }
public override void Play(ISkillAttacker attacker, SkillEffect se) { //player.animation.CrossFade(name, 0.2); //caster.SendMessage(event_name, param); }