예제 #1
0
    public void init(Quaternion direction, SkillStat stat, Transform target)
    {
        transform.rotation = direction;
        List <float> stats = stat.getStats();

        damage          = stats[2];
        duration        = stats[3];
        speed           = stats[4];
        normalizedSpeed = (transform.rotation * new Vector3(1, 0, 0)).normalized * speed;
        type            = stat.getSkillType();
        this.target     = target;
    }
예제 #2
0
    public void activateSkill()
    {
        switch (currentSkill.getSkillType())
        {
        case SkillStat.SkillType.Projectile:
            var projectile = Instantiate(currentSkill.getPrefabs()[0], new Vector3(transform.position.x, transform.position.y, -1), Quaternion.identity);
            projectile.GetComponent <Skill>().init(skillRange.GetComponent <SkillRange>().direction(), currentSkill, null);
            mp -= currentSkill.getStats()[0];
            cooldown[currentSkillNum] += currentSkill.getStats()[1];
            currentSkillNum            = -1;
            break;

        case SkillStat.SkillType.TargetedProjectile:
            var targetedProjectile = Instantiate(currentSkill.getPrefabs()[0], new Vector3(transform.position.x, transform.position.y, -1), Quaternion.identity);
            targetedProjectile.GetComponent <Skill>().init(skillRange.GetComponent <SkillRange>().direction(), currentSkill, skillRange.GetComponent <SkillRange>().getTarget().transform);
            mp -= currentSkill.getStats()[0];
            cooldown[currentSkillNum] += currentSkill.getStats()[1];
            currentSkillNum            = -1;
            break;
        }
        DeleteSkillRange();
    }