コード例 #1
0
        public override void activate(Player player)
        {
            Vector3 pos = Input.mousePosition;

            pos.z = player.getCameraHeightOffset();
            pos   = Camera.main.ScreenToWorldPoint(pos);
            Vector3         dir        = (pos - player.transform.position).normalized;
            GameObject      proj       = (GameObject)Instantiate(bullet, player.transform.position, Quaternion.identity);
            SkillshotBullet projScript = proj.GetComponent <SkillshotBullet>();

            projScript.setSource(player.gameObject);
            projScript.seek(dir);
            projScript.setDamage(damage);
            projScript.setRange(range);
            projScript.setTargetTag(player.targetTag);
            projScript.setIgnoreArmor(level == 3);
            if (level == 3)
            {
                projScript.setFireball(true);
                proj.GetComponent <Renderer>().enabled = false;
                AblazeBuff ab = new AblazeBuff(player.gameObject, 2f, damage / 8f, .25f, 0, ablazeEffect);
                projScript.setBuffToApply(ab);
            }
            projScript.setPlayerShot(true);
            nextFire = Time.time + cooldown;
        }
コード例 #2
0
        void shoot(Player player, Vector3 dir)
        {
            GameObject      proj       = (GameObject)Instantiate(level == 3 ? projectileMissile : projectileBullet, player.transform.position, Quaternion.identity);
            SkillshotBullet projScript = proj.GetComponent <SkillshotBullet>();

            projScript.setSource(player.gameObject);
            proj.transform.localScale /= 1.6f;
            projScript.seek(dir);
            projScript.setDamage(damagePerProjectile);
            projScript.setRange(range);
            projScript.setTargetTag(player.targetTag);
            projScript.setIgnoreArmor(false);
            projScript.setPlayerShot(true);
            if (level >= 2)
            {
                ArmorShredBuff buff = new ArmorShredBuff(2, armorShred);
                projScript.setBuffToApply(buff);
            }
            projScript.setExplosionRadius(level == 3 ? explosionRadius : 0f);
            projScript.setChanceToImpactEffect(level == 3 ? .2f : 1f);
        }