예제 #1
0
        //根据配置文件中的设定,装配玩家技能信息
        public void AssemblePlayerSkillsInfo()
        {
            //SkillInfo skillInfo1 = new SkillInfo();
            //skillInfo1.strEngName = "fire furious";
            //skillInfo1.strChnName = "火焰雨";
            //skillInfo1.strBtnName = "S_fire_furious";
            //skillInfo1.strEntityClassName = "FireFuriousEntity";
            //skillInfo1.strKeyCode = "E";
            //skillInfo1.intSkillOrBuff = 1;
            //skillInfo1.intHP = 100;
            //skillInfo1.intMP = 120;
            //skillInfo1.cdTime = 30;

            FromJsonToObject();

            foreach (SkillInfo skillInfo in skillInfoList)
            {
                InstantiateParticleByName(skillInfo.strSingingParticle, out skillInfo.singingParticle);
                AddParticleToGameObject(skillInfo.singingParticle, PlayerManager.playerGO);

                InstantiateParticleByName(skillInfo.strReleasingParticle, out skillInfo.releasingParticle);
                //releasingParticle挂载到playerGO上的目的是为了方便管理
                //AddParticleToGameObject(skillInfo.releasingParticle, PlayerManager.playerGO);

                Assembly    assembly     = Assembly.GetExecutingAssembly(); // 获取当前程序集
                SkillInfo[] arrSkillInfo = new SkillInfo[1];
                arrSkillInfo[0] = skillInfo;
                ISkillEntity skillEntity = assembly.CreateInstance("SurvivalShooter.Skill." + skillInfo.strEntityClassName,
                                                                   true, System.Reflection.BindingFlags.CreateInstance, null, arrSkillInfo, null, null) as ISkillEntity;
                //Debug.Log(skillEntity1.ToString());
                skillEntityList.Add(skillEntity);

                SkillStateMachine skillStateMachine = new SkillStateMachine(skillEntity);

                skillEntity.SetSkillStateMachine(skillStateMachine);

                playerSkillsInfo.Add(skillInfo.strBtnName, skillStateMachine);

                GameObject         skillInnerImgGO    = PlayerManager.skillPanelGO.transform.Find(skillInfo.strBtnName + "/" + skillInfo.strBtnName).gameObject;
                PlayerCastingSkill playerCastingSkill = skillInnerImgGO.AddComponent <PlayerCastingSkill> ();
                playerCastingSkill.skillInfo = skillInfo;
            }
        }