Ejemplo n.º 1
0
        protected virtual IEnumerator HandleActiveSkillSlot(int slot, params ISimpleStatusContext[] targets)
        {
            var skillData  = this.m_SkillSlot [slot];
            var skillDelay = skillData.skillDelay;
            var skillCtrl  = CObjectPoolManager.Get <CSkillController> (skillData.objectName);

            while (skillCtrl == null)
            {
                try {
                    skillCtrl = GameObject.Instantiate(Resources.Load <CSkillController> ("ObjectPrefabs/" + skillData.objectModel));
                    CObjectPoolManager.Set <CSkillController> (skillData.objectName, skillCtrl);
                } catch (Exception ex) {
                    throw new Exception(ex.Message);
                }
                yield return(skillCtrl != null);

                skillCtrl = CObjectPoolManager.Get <CSkillController> (skillData.objectName);
            }
            var targetCtrl = targets [0].GetController() as CObjectController;

            skillCtrl.SetData(skillData);
            skillCtrl.SetOwner(this.m_OwnerController);
            skillCtrl.SetTargetEnemy(targetCtrl);
            skillCtrl.SetActive(true);
            skillCtrl.SetPosition(targetCtrl.GetPosition());
            skillCtrl.SetRotation(this.m_Owner.GetPosition());
            this.m_DelayTemps [slot] = skillDelay;
        }
        public override void StartState()
        {
            base.StartState();
            var skillData = this.m_Controller.GetData() as CSkillData;

            CObjectPoolManager.Set <CSkillController> (skillData.objectName, this.m_Controller);
            this.m_Controller.SetActive(false);
        }