示例#1
0
        private bool ExecuteSkill(SkillHandler data)
        {
            bool result = false;

            if (!isEnabled)
            {
                return(result);
            }

            if (data.inCD)
            {
                return(result);
            }

            if (!data.enabled)
            {
                if (data.skill == null)
                {
                    DebugUtils.Log(DebugUtils.Type.AI_SkillTrigger, string.Format("{0} unit {1} execute skill {2} by trigger {3} protoId:{4}", owner.mark, owner.id, data.skillProto.Name, data.unitSkillTriggerType, data.skillProto.ID));

                    Skill skillUnit = owner.ReleaseSkill(ownerSkillDic[data.skillProto.ID].skillProto, ownerSkillDic[data.skillProto.ID].skillIndex);
                    if (skillUnit)
                    {
                        data.enabled = true;
                        data.skill   = skillUnit;
                        data.skillId = skillUnit.id;
                        result       = skillUnit.DependOnSkillState();
                    }
                    else
                    {
                        DebugUtils.LogError(DebugUtils.Type.AI_SkillTrigger, string.Format("{0} unit {1} execute skill {2} {3} failed! protoId:{4}", owner.mark, owner.id, data.skillProto.Name, data.unitSkillTriggerType, data.skillProto.ID));
                    }
                }
                else
                {
                    //DebugUtils.LogError( DebugUtils.Type.AI_SkillTrigger, " Skill unit was not empty, but SkillHandler in unable state,  It's strange! " );
                }
            }

            return(result);
        }