Esempio n. 1
0
    BaseSkill CreateSkill(
        BaseObject owner, SkillTemplate skillTemplate)
    {
        //BaseSkill makeSkill = null;
        makeSkill = null;
        GameObject skillObject = new GameObject();

        //Transform parentTransform = null;
        parentTransform = null;
        //은기 주력으로 수정해야 할 부분
        switch (skillTemplate.SKILL_TYPE)
        {
        case eSkillTemplateType.TARGET_ATTACK:
        {
            makeSkill       = skillObject.AddComponent <MeleeSkill>();
            parentTransform = owner.SelfTransform;
        }
        break;

        case eSkillTemplateType.TARGET_BLOCK:
        {
            makeSkill       = skillObject.AddComponent <BlockSkill>();
            parentTransform = owner.SelfTransform;
        }
        break;

        case eSkillTemplateType.RANGE_ATTACK:
        {
            makeSkill       = skillObject.AddComponent <RangeSkill>();
            parentTransform = owner.SelfTransform;
            parentTransform = owner.FindInChild("FirePos");


            makeSkill.ThrowEvent(ConstValue.EventKey_SelectModel,
                                 GetModel(eSkillModelType.Arrow_Regular));
        }
        break;
        }

        skillObject.name = skillTemplate.SKILL_TYPE.ToString();

        //skillObject.transform.localScale = parentTransform.localScale;

        if (makeSkill != null)
        {
            makeSkill.transform.position = parentTransform.position;
            makeSkill.transform.rotation = parentTransform.rotation;
            //

            makeSkill.OWNER          = owner;
            makeSkill.SKILL_TEMPLATE = skillTemplate;
            makeSkill.TARGET         =
                owner.GetData(ConstValue.ActorData_GetTarget) as BaseObject;

            makeSkill.InitSkill();
        }

        switch (skillTemplate.RANGE_TYPE)
        {
        //skillTemplate
        case eSkillAttackRangeType.RANGE_BOX:
        {
            BoxCollider collider = skillObject.AddComponent <BoxCollider>();
            collider.size = new Vector3(skillTemplate.RANGE_DATA_1,
                                        skillTemplate.RANGE_DATA_2, skillTemplate.RANGE_DATA_3);        // 건희 06/27
            collider.center = new Vector3(
                skillTemplate.RANGE_CENTER_1,
                skillTemplate.RANGE_CENTER_2,
                skillTemplate.RANGE_CENTER_3);                                // 건희 06/27
            collider.isTrigger = true;
        }
        break;

        case eSkillAttackRangeType.RANGE_SPHERE:
        {
            SphereCollider collider = skillObject.AddComponent <SphereCollider>();
            collider.radius    = skillTemplate.RANGE_DATA_1;
            collider.isTrigger = true;
        }
        break;

        case eSkillAttackRangeType.RANGE_CAPSULE:
        {
            CapsuleCollider collider = skillObject.AddComponent <CapsuleCollider>();
            collider.radius    = skillTemplate.RANGE_DATA_1;
            collider.height    = skillTemplate.RANGE_DATA_2;
            collider.direction = 2;
            collider.isTrigger = true;
        }
        break;
        }

        return(makeSkill);
    }