public override void Start() { BattleEntity ent = m_casterObject.GetEnt() as BattleEntity; int animaId = m_casterData.animaName; if (m_casterObject.m_bMaster) { animaId += ent.m_commonAtkIndex; } ent.PlayAnima(animaId, () => { m_casterObject.ResetState(); }); TimeMgr.Inst.RegisterEvent(m_casterData.startTime * 0.001f, () => { int effectId = m_casterData.effectId; effectId += ent.m_commonAtkIndex; //Debug.Log("effectId:" + effectId); m_curCasterEffectHid = CEffectMgr.Create(effectId, ent, m_casterData.bindPoint); if (m_casterObject.m_bMaster) { ent.m_commonAtkIndex++; if (ent.m_commonAtkIndex >= 3) { ent.m_commonAtkIndex = 0; } } }); }
public override void Init() { m_lifeEventHid = CFrameTimeMgr.Inst.RegisterEvent(m_buffData.ContinuanceTime, () => { Destroy(); }); int val = m_buffData.ParamValue1; if (OnHurt(val) == 1) { //SkillBase.AddBuff(m_caster, m_rec, 1000, Vector2.zero, Vector3.zero, Vector2.zero); // 一次伤害的BUFF,单独播放受击特效,而不是走表现层buff UpdateVO_ShowEffect_One(m_rec, m_buffData.effectId, m_buffData.effectPoint); // 受击者有霸体,不播放动作 if (m_rec.CheckState(eBuffState.SuperArmor)) { return; } UpdateVO_HitAnima(m_rec, m_buffData.animaId); } // 如果子弹未检测到敌人,结束时播放特效 if (m_rec == null && m_caster != null && m_caster.GetVObject() != null) { Vector3 casterH = m_caster.GetVObject().GetHitHeight(); CEffectMgr.Create(m_buffData.effectId, m_skillPos.ToVector3() + casterH, m_skillDir.ToVector3()); } }
public static void OnChangeLv(CCreature obj, int newV, int oldV) { if (newV == oldV) { return; } // 逻辑层 obj.UpdateProp(); int maxHp = obj.GetPropNum(eCreatureProp.Hp); // 主角升级才回满血 //if (obj.IsMaster()) //{ // obj.SetPropNum(eCreatureProp.CurHp, maxHp); //} // 表现层 obj.UpdateVO_ShowHeadLv(); obj.UpdateVO_ShowHeadHp(); obj.UpdateUI_Lv(); if (oldV != 0 && obj.IsMaster()) { if (obj.m_vCreature != null) { CEffectMgr.Create(21160, obj.m_vCreature.GetEnt(), "origin"); } } }
private void OnCreateUI() { if (m_photoImage == null) { return; } m_photoImage.gameObject.SetActiveNew(true); UIDragListener.Get(m_photoImage.gameObject).OnDragEvent = (ev, delta) => { if (m_boneEnt == null) { return; } if (m_boneEnt.m_animation != null && m_boneEnt.m_animation.IsPlaying("born")) { return; } if (ev == eDragEvent.Drag) { m_boneEnt.SetDirection(m_boneEnt.GetRotate() + new Vector3(0f, -1 * delta.x, 0f)); } }; UIEventListener.Get(m_photoImage.gameObject).onClick = (obj) => { if (m_boneEnt == null || m_boneEnt.m_animation == null || !m_bCanClick) { return; } if (m_boneEnt.m_animation.IsPlaying("idle") && !m_boneEnt.m_animation.IsPlaying(m_showEffectData.clickAnimaName)) // 在休闲时,才播放点击动作 { m_bCanClick = false; AnimationAction anima = new AnimationAction(); anima.crossTime = 0.2f; anima.strFull = m_showEffectData.clickAnimaName; anima.eMode = WrapMode.Once; anima.endEvent = () => { m_bCanClick = true; AnimationAction anima2 = new AnimationAction(); anima2.crossTime = 0.2f; anima2.strFull = "idle"; anima2.eMode = WrapMode.Loop; Play(anima2); OnCreateIdleEffect(); }; Play(anima); OnDestroyIdleEffect(); // 点击播放动作时,播放对应的特效,切换动作时删除 int hId = CEffectMgr.Create(m_showEffectData.clickEffectId, m_boneEnt, "origin"); CEffect ef = CEffectMgr.GetEffect(hId); if (ef != null) { ef.SetLayer(LusuoLayer.eEL_Photo); } } }; }
public void OnCreateIdleEffect() { OnDestroyIdleEffect(); // 待机动作时的特效 m_idleEffectHid = CEffectMgr.Create(m_showEffectData.idleEffectId, m_boneEnt, "origin"); CEffect effect = CEffectMgr.GetEffect(m_idleEffectHid); if (effect != null) { effect.SetLayer(LusuoLayer.eEL_Photo); } }
public void ShowFootHalo_Master() { if (!m_bMaster) { return; } if (m_ent == null || !m_ent.IsInited()) { return; } DestoryFootHalo_Master(); m_masterHaloHid = CEffectMgr.Create(6, GetEnt(), "origin"); }
private void OnCreateEnterEffect(object obj) { if (m_photoObject == null) { return; } int effectId = (int)obj; int hId = CEffectMgr.Create(effectId, m_photoObject.transform.position, Vector3.zero); CEffect ef = CEffectMgr.GetEffect(hId); if (ef != null) { ef.SetLayer(LusuoLayer.eEL_Photo); } m_enterEffectHid.Add(hId); }
private void OnEnter() { // 先播放入场特效 if (m_showEffectData == null) { Debug.LogError("英雄展示特效表无资源id:" + m_resId); OnCreateEnterPhoto("born"); return; } string[] timeList = m_showEffectData.enterEffectTime.Split('|'); string[] effectList = m_showEffectData.enterEffectId.Split('|'); for (int i = 0; i < timeList.Length; i++) { float time = 0; float.TryParse(timeList[i], out time); int effectId = 0; int.TryParse(effectList[i], out effectId); int eEventId = TimeMgr.Inst.RegisterEvent(time, () => { int hId = CEffectMgr.Create(effectId, m_photoObject.transform.position, Vector3.zero); CEffect ef = CEffectMgr.GetEffect(hId); if (ef != null) { ef.SetLayer(LusuoLayer.eEL_Photo); } m_enterEffectHid.Add(hId); }); m_eventList.Add(eEventId); } // 入场播放动作 int eventId = TimeMgr.Inst.RegisterEvent(m_showEffectData.enterAnimaTime, () => { if (m_photoObject == null) { return; } string animaName = m_showEffectData.enterAnimaName; EntityBaseInfo info = new EntityBaseInfo(); info.m_resID = (int)m_resId; info.m_ilayer = (int)LusuoLayer.eEL_Photo; m_handleId = EntityManager.Inst.CreateEntity(eEntityType.eBoneEntity, info, (ent) => { if (m_photoObject == null) { return; } // 播放人物动作 if (m_type == PhotoType.hero) { m_boneEnt = ent as BoneEntity; m_boneEnt.SetParent(m_photoObject.transform); string idleAnima = "idle"; AnimationAction anima = new AnimationAction(); anima.strFull = animaName; anima.eMode = WrapMode.Once; anima.endEvent = () => { AnimationAction anima2 = new AnimationAction(); anima2.crossTime = AnimationInfo.m_crossTime; anima2.strFull = idleAnima; anima2.eMode = WrapMode.Loop; Play(anima2); OnCreateIdleEffect(); }; Play(anima); } else if (m_type == PhotoType.uieffect) { m_boneEnt = ent as BoneEntity; m_boneEnt.SetParent(m_photoObject.transform); AnimationAction anima = new AnimationAction(); anima.strFull = "idle"; anima.eMode = WrapMode.Loop; Play(anima); } }); }); m_eventList.Add(eventId); // 播放英雄声音 m_speakSoundHid = SoundManager.Inst.PlaySound(m_showEffectData.enterSpeakId, null); }
public override void PushCommand(IFspCmdType cmd) { BattleEntity ent = GetEnt() as BattleEntity; //Debug.Log("切换:" + cmd.GetCmdType()); switch (cmd.GetCmdType()) { #region 常态 case CmdFspEnum.eFspStopMove: m_state = cmd.GetCmdType(); SetMove(false); //Debug.Log("设置停止"); ((BattleEntity)GetEnt()).SetPriority(0); ResetState(); break; case CmdFspEnum.eFspMove: case CmdFspEnum.eFspAutoMove: m_state = cmd.GetCmdType(); SetMove(true); //Debug.Log("设置移动"); ResetState(); break; case CmdFspEnum.eUIHead: CmdUIHead head = cmd as CmdUIHead; switch (head.type) { case 1: if (m_head != null) { m_head.SetName(head.name); } break; case 2: if (m_head != null) { m_head.SetLevel(head.lv); } break; case 3: if (m_head != null) { m_head.SetHp(head.curHp, head.maxHp); } break; case 4: if (m_head != null) { m_head.SetHud(head.hudText, head.hudType); } break; case 5: if (m_head != null) { m_head.SetHeadShow(head.bShow); } break; case 8: if (m_head != null) { m_head.SetTeam(head.bTeam); } break; //case 9: // if (m_head != null) // m_head.ShowNameOnly(head.bShow); // break; case 10: // The state of dizziness does not play the hit action //if (CheckState(eVObjectState.stun)) // return; ent.PlayAnima(head.animaId, () => { ResetState(); }); break; case 11: if (head.effectBindPos == (int)SBindPont.eBindType.CreatureHeadPos) { CEffectMgr.CreateByCreaturePos(head.effectId, ent, 2); } else if (head.effectBindPos == (int)SBindPont.eBindType.Muzzle) // 枪口 { CEffectMgr.Create(head.effectId, ((BattleEntity)GetEnt()). GetRightPoint()); } else { CEffectMgr.Create(head.effectId, GetEnt(), SBindPont.GetBindPont(head.effectBindPos)); } break; case 12: if (head.bRide) { m_ride = true; VObject obj = head.rideObject; GetEnt().SetParent(((BattleEntity)obj.GetEnt()).GetBone("ride")); } else { m_ride = false; GetEnt().ClearBind(); Quaternion dest = Quaternion.LookRotation(m_moveInfo.m_dir); GetEnt().SetRot(dest); GetEnt().SetScale(Vector3.one * m_baseInfo.m_scale); } break; //case 13: // if (m_head != null) // m_head.SetTaskState(head.taskstate); // break; case 14: ShowFootHalo(head.effectId); break; } break; case CmdFspEnum.eLife: if (ent == null) { return; } CmdLife life = cmd as CmdLife; m_bDead = !life.state; if (life.state) { ent.SetPriority(0); ent.PlayAnima(SMtCreatureAnima.ANIMA_RESET, () => { ResetState(); // 复活说话 //PlaySpeak(eRoleSpeakCsv.revive); }); // 播放复活特效 if (m_bMaster) { CEffectMgr.Create(21002, GetEnt().GetPos(), GetEnt().GetRotate()); } } else { SetMove(false); ent.PlayAnima(SMtCreatureAnima.ANIMA_DIE); //SoundManager.Inst.PlaySound(m_baseInfo.m_dieSound, ent.GetPos()); CEffectMgr.Create(m_baseInfo.m_dieEffect, GetEnt(), SBindPont.ORIGIN); // xingzuo sound PlayerCsv playerCsv = CsvManager.Inst.GetCsv <PlayerCsv>((int)eAllCSV.eAC_Player); PlayerCsvData csvData = playerCsv.GetData(m_baseInfo.csvId); if (csvData != null) { int soundId = 0, pct = 0; JoyStickModule.GetSpeak(csvData.dieSpeak, ref soundId, ref pct); SoundManager.Inst.PlaySound(soundId, (e) => { e.SetPos(m_moveInfo.m_pos); }); } // 死亡说话 //PlaySpeak(eRoleSpeakCsv.die); } break; #endregion case CmdFspEnum.eFspUpdateEquip: m_cmdUpdateEquip = cmd as CmdFspUpdateEquip; UpdateEquip(); break; #region BUFF特效 case CmdFspEnum.eBuff: // 特效挂点设置 CmdFspBuff buff = cmd as CmdFspBuff; int effectId = buff.effectId; if (effectId == 0) { return; } //Debug.Log(buff.effectId + " add:" + buff.bAdd + " " + buff.bindType); if (m_dicBuff == null) { m_dicBuff = new Dictionary <int, object>(); } if (m_dicBuffCount == null) { m_dicBuffCount = new Dictionary <int, int>(); } if (buff.bAdd) { if (!m_dicBuff.ContainsKey(effectId)) { if (buff.bindType == (int)SBindPont.eBindType.LRHand) // 左右手 { List <int> hid = new List <int>(); int l = CEffectMgr.Create(effectId, m_ent, SBindPont.L_HAND); int r = CEffectMgr.Create(effectId, m_ent, SBindPont.R_HAND); hid.Add(l); hid.Add(r); m_dicBuff[effectId] = hid; if (!IsVisible()) { CEffectMgr.GetEffect(l).SetShow(false); CEffectMgr.GetEffect(r).SetShow(false); } } else if (buff.bindType == (int)SBindPont.eBindType.CreaturePos) { int hid = CEffectMgr.CreateByCreaturePos(effectId, m_ent, 1); m_dicBuff[effectId] = hid; if (!IsVisible()) { CEffect c = CEffectMgr.GetEffect(hid); if (c != null) { c.SetShow(false); } } } else if (buff.bindType == (int)SBindPont.eBindType.CreatureHeadPos) { int hid = CEffectMgr.CreateByCreaturePos(effectId, m_ent, 2); m_dicBuff[effectId] = hid; if (!IsVisible()) { CEffect c = CEffectMgr.GetEffect(hid); if (c != null) { c.SetShow(false); } } } else { int hid = CEffectMgr.Create(effectId, m_ent, SBindPont.GetBindPont(buff.bindType), null); m_dicBuff[effectId] = hid; if (!IsVisible()) { CEffect c = CEffectMgr.GetEffect(hid); if (c != null) { c.SetShow(false); } } } } if (!m_dicBuffCount.ContainsKey(effectId)) { m_dicBuffCount[effectId] = 1; } else { m_dicBuffCount[effectId]++; } } else { if (m_dicBuffCount.ContainsKey(effectId)) { m_dicBuffCount[effectId]--; if (m_dicBuffCount[effectId] <= 0) { m_dicBuffCount.Remove(effectId); } } if (m_dicBuff.ContainsKey(effectId) && !m_dicBuffCount.ContainsKey(effectId)) // 如果包含这个BUFF,并且计数=0,才销毁 { if (buff.bindType == (int)SBindPont.eBindType.LRHand) { List <int> hid = (List <int>)m_dicBuff[effectId]; for (int i = 0; i < hid.Count; i++) { CEffectMgr.Destroy(hid[i]); } } else { CEffectMgr.Destroy((int)m_dicBuff[effectId]); } m_dicBuff.Remove(effectId); } } break; #endregion #region 状态表现 case CmdFspEnum.eState: // 外观状态设置 CmdFspState state = cmd as CmdFspState; eVObjectState type = state.type; //Debug.Log("状态 add:" + state.bAdd + " " + (eVObjectState)type); if (state.bAdd) { SetShowState(type, true); switch (type) { case eVObjectState.WindBlowsUp: ent.SetWindBlowsUp(true); break; case eVObjectState.GhostShadow: ent.SetGhostShadow(true); break; case eVObjectState.AlphaToHide: // 全透 all alpha need hide effect ent.SetShader(eShaderType.eAlphaToHide, Color.white, 0.3f, false, () => { ent.SetShow(false); }); break; case eVObjectState.AlphaToHalf: // 半透 GetEnt().SetShow(true); if (CheckState(eVObjectState.AlphaToHide)) // 半透,全透状态应该是互斥的 { SetShowState(eVObjectState.AlphaToHide, false); ent.SetShader(eShaderType.eAlphaToHalf, Color.white, 0.0f, false); } else { ent.SetShader(eShaderType.eAlphaToHalf, Color.white, 0.3f, false); } break; case eVObjectState.Nihility: // 虚无 //if (m_head != null) //{ // m_head.SetHeadAlpha(0.5f); //} //ent.SetShader(eShaderType.eNihility, new Color(1, 1, 1, 0.7f)); break; case eVObjectState.God: // 无敌 //ent.SetShader(eShaderType.eRim, Color.yellow); break; case eVObjectState.Hit: // 受击 //ent.SetShader(eShaderType.eRim, new Color(0.8f, 0.8f, 0.8f, 1.0f)); break; case eVObjectState.Silence: // 被沉默 if (m_bMaster) { JoyStickModule js = (JoyStickModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelJoyStick); //js.SetLock(true); } break; case eVObjectState.Show: GetEnt().SetShow(true); break; case eVObjectState.stun: // 晕眩 //((BattleEntity)GetEnt()).Play(false); if (m_bMaster) { JoyStickModule js = (JoyStickModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelJoyStick); //js.SetLock(true); } break; case eVObjectState.unmove: // 禁锢 break; case eVObjectState.sleep: // 睡眠 if (m_bMaster) { JoyStickModule js = (JoyStickModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelJoyStick); //js.SetLock(true); } break; } } else { SetShowState(type, false); switch (type) { case eVObjectState.WindBlowsUp: ent.SetWindBlowsUp(false); break; case eVObjectState.GhostShadow: ent.SetGhostShadow(false); break; case eVObjectState.AlphaToHide: // 全透 ent.RemoveShader(); ent.SetShow(true); break; case eVObjectState.AlphaToHalf: // 半透,暂时都只用了移除全透 if (m_head != null) { m_head.SetHeadAlpha(1.0f); } ent.RemoveShader(); break; case eVObjectState.Nihility: case eVObjectState.God: case eVObjectState.Hit: //if (m_head != null) //{ // m_head.SetHeadAlpha(1.0f); //} //ent.RemoveShader(); break; case eVObjectState.Silence: // 取消沉默 if (m_bMaster) { JoyStickModule js = (JoyStickModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelJoyStick); //js.SetLock(false); } break; case eVObjectState.Show: GetEnt().SetShow(false); break; case eVObjectState.stun: // 晕眩 //((BattleEntity)GetEnt()).Play(true); ResetState(); if (m_bMaster) { JoyStickModule js = (JoyStickModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelJoyStick); //js.SetLock(false); } break; case eVObjectState.unmove: // 禁锢 ResetState(); break; case eVObjectState.sleep: // 睡眠 ResetState(); if (m_bMaster) { JoyStickModule js = (JoyStickModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelJoyStick); //js.SetLock(false); } break; } } break; #endregion case CmdFspEnum.eSkillAnimaPriority: // 设置技能动作优先级 CmdSkillAnimaPriority cmdPri = cmd as CmdSkillAnimaPriority; ((BattleEntity)GetEnt()).SetPriority(cmdPri.priority); break; } }
/// <summary> /// 常规技能的开始阶段 /// 1.也包含了循环动作的技能,如旋风斩 /// 2.支持背后武器火炮的攻击时,挂点的改变 /// </summary> public virtual void Start() { BattleEntity ent = m_casterObject.GetEnt() as BattleEntity; int animaId = m_casterData.animaName; AnimationCsv anima = CsvManager.Inst.GetCsv <AnimationCsv>((int)eAllCSV.eAC_Animation); m_curAnima = anima.GetData(animaId); if (m_curAnima != null) { CmdSkillAnimaPriority cmd = new CmdSkillAnimaPriority(); m_casterObject.PushCommand(cmd); if (m_curAnima.mode == (int)WrapMode.Loop) { ent.PlayAnima(animaId, null); } else { if (m_curAnima.switchHand) // 如果是火炮,特殊处理一下,施法时武器切换到手上 { ent.BackEquipStart(); } ent.PlayAnima(animaId, () => { ent.BackEquipEnd(); }); } } int effectId = m_casterData.effectId; if (m_casterData.startTime == 0) { m_curCasterEffectHid = CEffectMgr.Create(effectId, ent, m_casterData.bindPoint); } else { TimeMgr.Inst.RegisterEvent(m_casterData.startTime * 0.001f, () => { m_curCasterEffectHid = CEffectMgr.Create(effectId, ent, m_casterData.bindPoint); }); } if (m_casterObject == null || m_curSkillCmd == null || m_casterObject.m_cmdUpdateEquip == null) { return; } // 播放语音,1手雷 2火炮 //if (m_curSkillCmd.m_skillIndex == 0) //{ // if (m_casterObject.m_cmdUpdateEquip.m_armsType == (int)eArmsType.Near) // { // m_casterObject.PlaySpeak(eRoleSpeakCsv.skill1Near); // } // else // { // m_casterObject.PlaySpeak(eRoleSpeakCsv.skill1Far); // } //} //else if(m_curSkillCmd.m_skillIndex == 1) //{ // m_casterObject.PlaySpeak(eRoleSpeakCsv.skill2); //} //else if(m_curSkillCmd.m_skillIndex == 2) //{ // m_casterObject.PlaySpeak(eRoleSpeakCsv.skill3); //} }