Exemple #1
0
 private void ButtonTriggered()
 {
     nextReadyTime        = coolTime + Time.time;
     coolDownTimeLeft     = coolTime;
     darkMask.enabled     = true;
     coolDownText.enabled = true;
     apControl.UseSkill(skill.skillCost);
     skill.ActivateSkill();
 }
Exemple #2
0
    /* 스킬 하나를 사용 */
    public void UseSkill(int index, Vector2 direction)
    {
        //스킬이 없으면 사용 불가
        if (skill_List[index] == null)
        {
            return;
        }
        //해당 스킬의 쿨타임이 남아있으면 사용 불가
        if (coolTimerList[index] > 0)
        {
            return;
        }

        GameObject skillObj;

        if (direction == Vector2.up)
        {
            skillObj = Instantiate(skill_List[index], transform.GetChild(0));
            skillObj.transform.Rotate(0, 0, 180);
        }
        else if (direction == Vector2.down)
        {
            skillObj = Instantiate(skill_List[index], transform.GetChild(1));
            skillObj.transform.Rotate(0, 0, 0);
        }
        else if (direction == Vector2.left)
        {
            skillObj = Instantiate(skill_List[index], transform.GetChild(2));
            skillObj.transform.Rotate(0, 0, -90);
        }
        else
        {
            skillObj = Instantiate(skill_List[index], transform.GetChild(3));
            skillObj.transform.Rotate(0, 0, 90);
        }

        Skill skill = skillObj.GetComponent <Skill>();

        skill.skillCaster = playerControl.gameObject;
        skill.SetSkillIndex(index);
        skill.skillDirection = direction;
        if (skill.isOnHead)
        {
            skillObj.transform.position = transform.position;
        }                                                                           //스킬 범위가 자신의 위치가 중심인 경우
        skillDelay = skill.delay;
        playerControl.SetIsDelay(true);
        skill.ActivateSkill();
    }