public override void Preload(ISkillCellData cellData, SkillBase skillBase) { StateParameter stateParm = new StateParameter(); stateParm.state = ACTOR_STATE.AS_DEATH; CompositedSkillCellDesc tmpCellDesc = (CompositedSkillCellDesc)cellData; for (int i = 0; i < tmpCellDesc.SkillList.Count; ++i) { int skillID = tmpCellDesc.SkillList[i].SkillId; LuaTable skillDesc = ConfigManager.Instance.Skill.GetSkillConfig(skillID); if (skillDesc == null) { continue; } SkillClassDisplayDesc skillClass = CoreEntry.gGameDBMgr.GetSkillClassDisplayDesc(skillDesc.Get <int>("skillDisplayID")); if (skillClass == null) { continue; } GameObject obj = CoreEntry.gGameObjPoolMgr.InstantiateSkillBase(skillClass.prefabPath); SkillBase tmpSkillBase = obj.GetComponent <SkillBase>(); tmpSkillBase.Preload(null, skillID); stateParm.skillID = skillID; tmpSkillBase.BreakSkill(stateParm); } }
Vector2 getSize(SkillClassDisplayDesc skillClass) { Vector2 re = new Vector2(0, 0); if (skillClass.castStageDataList.Count > 0) { OneDamageInfo damageInfo = (OneDamageInfo)skillClass.castStageDataList[0]; if (damageInfo != null) { if (DamageTypeID.DTID_RECT == damageInfo.type) { m_shape = TrapShape.SHAPE_rectangle; m_widthZ = damageInfo.damageNode.rectDamage.length; m_widthX = damageInfo.damageNode.rectDamage.width; } else if (DamageTypeID.DTID_FUN == damageInfo.type) { m_shape = TrapShape.SHAPE_circel; m_widthZ = damageInfo.damageNode.funDamage.radius; m_widthX = damageInfo.damageNode.funDamage.radius; } } } return(re); }
public override void OnEnter(ActorObj actor) { if (actor == null) { return; } m_state = ACTOR_STATE.AS_ATTACK; m_actor = actor; m_curSkillID = m_actor.castSkillID; //if (m_actor != null) //{ // m_actor.m_bIsInAttack = true; //} LuaTable skillDesc = ConfigManager.Instance.Skill.GetSkillConfig(m_curSkillID); if (skillDesc == null) { return; } SkillClassDisplayDesc skillClass = null; if (skillDesc != null) { //if (skillDesc.e_type_1 == 1) { skillClass = m_gameDBMgr.GetSkillClassDisplayDesc(skillDesc.Get <int>("skillDisplayID")); } } m_curSkillDesc = skillDesc; GameObject obj = null; if (skillClass != null) { obj = CoreEntry.gGameObjPoolMgr.InstantiateSkillBase("Skill/SkillBase");; //(GameObject)Instantiate(CoreEntry.gResLoader.LoadResource("Skill/SkillBase")); } else { // LogMgr.Log("Can not found skillClass skillDesc.skillDisplayID: " + skillDesc.Get<int>("skillDisplayID") + " ActorObj: " + m_actor); return; } if (obj == null) { return; } //设置脚本组件 SkillBase skillBase = obj.GetComponent <SkillBase>(); ActorObj hitObj = null; if (CurParam != null) { hitObj = CurParam.HitActor; } skillBase.Init(actor, hitObj, m_curSkillID); m_curSkillBase = skillBase; //霸体时间。不可以转换为其他状态,除了死亡 if (skillDesc.Get <int>("stiff_time") > 0) { StartEndure(); } //m_isSkillCastEnd = false; if (m_curSkillDesc.Get <int>("stiff_time") > 0) { CancelInvoke("SkillCastEnd"); Invoke("SkillCastEnd", m_curSkillDesc.Get <int>("stiff_time") / 1000f); } //一个人的时候触发关门 if (m_actor.mActorType == ActorType.AT_BOSS) { CoreEntry.gSceneMgr.CloseDoor(); } if (null != skillDesc && skillDesc.Get <int>("showtype") == (int)SkillShowType.ST_HUANLING && skillDesc.Get <int>("subtype") != (int)SkillType.SKILL_NORMAL) { bool isHuanlingSkill = false; if (actor.mActorType == ActorType.AT_LOCAL_PLAYER) { isHuanlingSkill = true; } else if (actor.mActorType == ActorType.AT_PET) { PetObj pet = actor as PetObj; if (pet != null && null != pet.m_MasterActor && pet.m_MasterActor.mActorType == ActorType.AT_LOCAL_PLAYER) { isHuanlingSkill = true; } } if (isHuanlingSkill) { EventParameter param = EventParameter.Get(); param.intParameter = skillDesc.Get <int>("showtype"); param.stringParameter = skillDesc.Get <string>("name"); CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_FLY_SKILL, param); } } }
public void ShowSkillScope() { SkillClassDisplayDesc skillClass = m_gameDBMgr.GetSkillClassDisplayDesc(m_skillDesc.Get <int>("skillDisplayID")); if (skillClass == null) { Debug.LogError("===skillClass== is null==="); return; } LuaTable skilleffect = ConfigManager.Instance.Skill.GetEffectConfig(m_skillID); if (skilleffect.Get <int>("range") == (int)SkillRangeType.SKILL_TARGET) // if ((int)m_skillDesc.atkType == (int)Configs.skillConfig.AtkTypeEnum.SINGLE) { m_bIsAoe = false; } //吟唱阶段 for (int i = 0; i < skillClass.prepareStageDataList.Count; ++i) { GameObject cellObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(skillClass.prepareStageDataList[i].prefabPath); cellObj.transform.parent = transform; ISkillCell skillCell = cellObj.GetComponent <ISkillCell>(); skillCell.Init(skillClass.prepareStageDataList[i], this); skillCell.SetAoeState(m_bIsAoe); AddSkillCell(cellObj); } //技能元素 for (int i = 0; i < skillClass.castStageDataList.Count; ++i) { GameObject cellObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(skillClass.castStageDataList[i].prefabPath); cellObj.transform.parent = transform; ISkillCell skillCell = cellObj.GetComponent <ISkillCell>(); skillCell.Init(skillClass.castStageDataList[i], this); skillCell.SetAoeState(m_bIsAoe); AddSkillCell(cellObj); } // 删除原来的预警贴花 if (m_actor.m_WarningefxObj != null) { Destroy(m_actor.m_WarningefxObj); m_actor.m_WarningefxObj = null; } // 读取新的预警贴花 for (int i = 0; i < m_skillCellObjectlist.Count; i++) { ISkillCell skillCell = m_skillCellObjectlist[i].GetComponent <ISkillCell>(); skillCell.ShowSkillScope(); if (m_actor.m_WarningefxObj != null) { break; } } if (m_actor.m_WarningefxObj != null) { EfxAttachActionPool efx = m_actor.m_WarningefxObj.GetComponent <EfxAttachActionPool>(); if (efx == null) { efx = m_actor.m_WarningefxObj.AddComponent <EfxAttachActionPool>(); } efx.Init(m_actor.transform, 100000f, true); } }
//释放技能 void CastSkill() { CancelInvoke("CastSkill"); CancelInvoke("AutoLookatTarget"); // 如果不是激活状态不往下运行 if (!gameObject.activeInHierarchy) { return; } //释放吟唱阶段的动作特效 SendEvent(SkillCellEventType.SE_DESTROY_ACTION_EFX, null); //销毁吟唱阶段数据 DestroyEfx(); //播放动作,特效,声音 SkillPlayParam param = new SkillPlayParam(); LuaTable skill_action = CoreEntry.gSkillMgr.GetSkillActon(m_skillID); if (skill_action == null) { Debug.LogError("skill_action is null...m_skillID = " + m_skillID); return; } if (skill_action != null) { param.action = skill_action.Get <string>("animation"); param.actionEfx = skill_action.Get <string>("skilleffect"); param.startTime = m_startPlayTimeSet; param.speed = m_speed; param.remainEfx = skill_action.Get <string>("remain"); } //播放声音 string sound1 = ""; string sound2 = ""; AudioCore.GenerateAudio(m_skillDesc.Get <int>("sound_id"), ref sound1); AudioCore.GenerateAudio(m_skillDesc.Get <int>("talk_sound_id"), ref sound2); param.sound = sound1; param.voice = sound2; StartCoroutine(PlayActionEfxSound(param, skill_action.Get <float>("skillEfxDelay"))); //技能元素 SkillClassDisplayDesc skillClass = m_gameDBMgr.GetSkillClassDisplayDesc(m_skillDesc.Get <int>("skillDisplayID")); if (skillClass == null) { Debug.LogError("===skillClass== is null==="); return; } bool isLocal = false; if (m_actor is PlayerObj || m_actor is PetObj) { isLocal = true; } for (int i = 0; i < skillClass.castStageDataList.Count; ++i) { if (null != m_actor && !isLocal) { if (skillClass.castStageDataList[i] is MovePosAttackDesc) { continue; } } GameObject cellObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(skillClass.castStageDataList[i].prefabPath); cellObj.transform.parent = transform; ISkillCell skillCell = cellObj.GetComponent <ISkillCell>(); skillCell.Init(skillClass.castStageDataList[i], this); skillCell.SetAoeState(m_bIsAoe); CheckSkillCell(skillCell); AddSkillCell(cellObj); } //技能结束时间 if (m_skillDesc.Get <int>("skill_end") > 0) { m_overTime = (m_skillDesc.Get <int>("skill_end") / 1000f - m_startPlayTimeSet) / m_speed; } else { m_overTime = (m_actor.GetActionLength(m_strActionName) - m_startPlayTimeSet) / m_speed; } //如果是不可打破机能,释放出后恢复动作 if (canBeBroke == false) { float time = (m_actor.GetActionLength(m_strActionName) - m_startPlayTimeSet) / m_speed; CancelInvoke("SkillAnimationIsOver"); Invoke("SkillAnimationIsOver", time); } LogMgr.UnityLog("overtime=" + m_overTime + ", skillid=" + m_skillID); //技能结束 Invoke("SkillEnd", m_overTime); }
// Use this for initialization void Start() { IsOver = false; CancelInvoke("Start"); if (m_onlyShowSkillScope) { return; } m_AttackList.Clear(); compositedSkillCell = null; ShowBossSkillWarning(); SkillClassDisplayDesc skillClass = m_gameDBMgr.GetSkillClassDisplayDesc(m_skillDesc.Get <int>("skillDisplayID")); if (skillClass == null) { Debug.LogError("===skillClass== is null==="); return; } if (null != m_skilleffect && m_skilleffect.Get <int>("range") == (int)SkillRangeType.SKILL_TARGET) { m_bIsAoe = false; } if (skillClass.prepareStage == null || skillClass.prepareStage.open == false) { //直接进入释放技能阶段 CastSkill(); return; } //吟唱阶段 bool isLocal = false; if (m_actor is PlayerObj || m_actor is PetObj) { isLocal = true; } for (int i = 0; i < skillClass.prepareStageDataList.Count; ++i) { if (null != m_actor && !isLocal) { if (skillClass.prepareStageDataList[i] is MovePosAttackDesc) { continue; } } //GameObject cellObj = Instantiate( // CoreEntry.gResLoader.LoadResource(skillClass.prepareStageDataList[i].prefabPath)) as GameObject; GameObject cellObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(skillClass.prepareStageDataList[i].prefabPath); cellObj.transform.parent = transform; ISkillCell skillCell = cellObj.GetComponent <ISkillCell>(); skillCell.Init(skillClass.prepareStageDataList[i], this); skillCell.SetAoeState(m_bIsAoe); AddSkillCell(cellObj); } if (skillClass.prepareStage.isLookAtTarget) { InvokeRepeating("AutoLookatTarget", 0f, 0.1f); } m_prepareKeepTime = skillClass.prepareStage.keepTime; //吟唱结束,进入释放阶段 Invoke("CastSkill", skillClass.prepareStage.keepTime); Syncm_transform(); }
public void Preload(ActorObj own, int skillID) { m_skillID = skillID; m_onlyShowSkillScope = true; m_actor = own; m_skillDesc = ConfigManager.Instance.Skill.GetSkillConfig(m_skillID); if (m_skillDesc == null) { return; } SkillClassDisplayDesc skillClass = m_gameDBMgr.GetSkillClassDisplayDesc(m_skillDesc.Get <int>("skillDisplayID")); if (skillClass == null) { return; } //吟唱阶段 for (int i = 0; i < skillClass.prepareStageDataList.Count; ++i) { GameObject cellObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(skillClass.prepareStageDataList[i].prefabPath); cellObj.transform.parent = transform; ISkillCell skillCell = cellObj.GetComponent <ISkillCell>(); skillCell.Preload(skillClass.prepareStageDataList[i], this); AddSkillCell(cellObj); } //技能元素 for (int i = 0; i < skillClass.castStageDataList.Count; ++i) { GameObject cellObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(skillClass.castStageDataList[i].prefabPath); if (cellObj == null) { LogMgr.UnityError("Can not found prefab: " + skillClass.castStageDataList[i].prefabPath + " ! of skillID " + skillClass.skillID + " : " + skillClass.castStageDataList[i].ToString()); continue; } cellObj.transform.parent = transform; ISkillCell skillCell = cellObj.GetComponent <ISkillCell>(); skillCell.Preload(skillClass.castStageDataList[i], this); AddSkillCell(cellObj); } // 动作特效加载 LuaTable skill_action = CoreEntry.gSkillMgr.GetSkillActon(skillID); if (skill_action != null && skill_action.Get <string>("skilleffect").Length > 0) { GameObject efxObj = CoreEntry.gGameObjPoolMgr.InstantiateEffect(skill_action.Get <string>("skilleffect")); if (efxObj != null) { CoreEntry.gGameObjPoolMgr.Destroy(efxObj); } else { LogMgr.LogError("can not find attackEfxPrefab path: " + skill_action.Get <string>("skilleffect")); } } // 受击特效加载 string pfx_hurt = m_skillDesc.Get <string>("pfx_hurt"); if (pfx_hurt.Length > 0) { GameObject efxObj = CoreEntry.gGameObjPoolMgr.InstantiateEffect(pfx_hurt); if (efxObj != null) { CoreEntry.gGameObjPoolMgr.Destroy(efxObj); } } DestroyEfx(); }