예제 #1
0
        public static void CreateMagicKey(ActorObj attackObj, int skillID)
        {
            GameObject efxObj       = null;
            LuaTable   skill_action = CoreEntry.gSkillMgr.GetSkillActon(skillID);

            if (skill_action != null)
            {
                object obj = CoreEntry.gResLoader.LoadResource(skill_action.Get <string>("skilleffect"));
                if (obj == null)
                {
                    LogMgr.LogError("找不到attackEfxPrefab:" + skill_action.Get <string>("skilleffect"));
                }

                efxObj = Instantiate((GameObject)obj) as GameObject; //CoreEntry.gGameObjPoolMgr.InstantiateEffect(param.actionEfx);
                if (efxObj != null)
                {
                    efxObj.transform.parent = attackObj.transform;

                    efxObj.transform.localPosition = Vector3.zero;
                    //efxObj.transform.localRotation = Vector3.zero;
                    efxObj.transform.localScale = Vector3.one;
                }
            }
            if (efxObj != null)
            {
                SkillMagicKeyBase mk = efxObj.GetComponent <SkillMagicKeyBase>();
                if (mk == null)
                {
                    mk = efxObj.AddComponent <SkillMagicKeyBase>();
                }
                mk.Init(attackObj, skillID);
            }

            LuaTable skillCfg = ConfigManager.Instance.Skill.GetSkillConfig(skillID);

            if (null != skillCfg && skillCfg.Get <int>("showtype") == (int)SkillShowType.ST_MAGICKEY)
            {
                EventParameter param = EventParameter.Get();
                param.intParameter    = skillCfg.Get <int>("showtype");
                param.stringParameter = skillCfg.Get <string>("name");
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_FLY_SKILL, param);
            }
        }
예제 #2
0
 public void OnUseMagicKeySkill(GameEvent ge, EventParameter param)
 {
     SkillMagicKeyBase.CreateMagicKey((ActorObj)param.objParameter, param.intParameter);
 }