override protected void Shoot() { IceBall missile = Instantiate(missilePrefab, shootingPosition.position, Quaternion.identity).GetComponent <IceBall>(); missile.targetPosition = currentEnemy.position; missile.explosionRange = missileExplosionRange; missile.damage = towerDamage; missile.armorPiercing = armorPiercing; missile.freezingRate = freezingRate; missile.freezingTime = freezingTime; }
public void CastIceBall() { IceBall iceballinstance = Instantiate(iceBall, projectileSpawn.position, projectileSpawn.rotation); iceballinstance.Direction = projectileSpawn.forward; }
private void Start() { fireball = Resources.Load <FireBall>("FireBall"); iceBall = Resources.Load <IceBall>("IceBall"); }
// Update is called once per frame void Update() { float h = Input.GetAxisRaw("Horizontal") * rotationalForce; float v = Input.GetAxisRaw("Vertical") * moveForce; transform.Rotate(0, h, 0); transform.Translate(0, 0, v); if (Input.GetKey(KeyCode.Space)) { if (Time.time > spell1CD) { GameObject fireballPrefab = AssetDatabase.LoadAssetAtPath("Assets/MagicArsenal/MagicProjectiles/Prefabs/Fire/FireProjectileNormal.prefab", typeof(GameObject)) as GameObject; GameObject go = (GameObject)Instantiate(fireballPrefab, gun.position, gun.rotation); Fireball fb = go.GetComponent <Fireball>(); fb.initialize(5, 5.0f, 5.0f, 20.0f, 10.0f, 10.0f); spell1CD = Time.time + 1; } } if (Input.GetKey(KeyCode.Q)) { if (Time.time > spell2CD) { GameObject iceballPrefab = AssetDatabase.LoadAssetAtPath("Assets/MagicArsenal/MagicProjectiles/Prefabs/Frost/FrostProjectileNormal.prefab", typeof(GameObject)) as GameObject; GameObject go = (GameObject)Instantiate(iceballPrefab, gun.position, gun.rotation); IceBall ib = go.GetComponent <IceBall>(); ib.initialize(5, 5.0f, 5.0f, 20.0f, 10.0f, 3.0f); spell2CD = Time.time + ib.Cooldown; } } if (Input.GetKey(KeyCode.R)) { if (Time.time > spell2CD) { GameObject stonefistPrefab = AssetDatabase.LoadAssetAtPath("Assets/MagicArsenal/MagicProjectiles/Prefabs/Earth/EarthProjectileMega.prefab", typeof(GameObject)) as GameObject; GameObject go = (GameObject)Instantiate(stonefistPrefab, gun.position, gun.rotation); StoneFist sf = go.GetComponent <StoneFist>(); sf.initialize(5, 5.0f, 5.0f, 20.0f, 5.0f, 2.0f); spell2CD = Time.time + sf.Cooldown; } } if (Input.GetKey(KeyCode.E)) { if (Time.time > earthWallCooldownTimer) { Instantiate(earthWall, gun.position, gun.rotation); earthWallCooldownTimer = Time.time + shootRate; } } if (Input.GetKey(KeyCode.Alpha1)) { if (Time.time > spell3CD) { GameObject swiftnessPrefab = Resources.Load("SpinningStorm", typeof(GameObject)) as GameObject; GameObject go = (GameObject)Instantiate(swiftnessPrefab, transform.position, transform.rotation); Swiftness sft = go.GetComponent <Swiftness>(); sft.initialize(2, 5, gameObject, 2); spell3CD = Time.time + sft.Cooldown; } } if (Input.GetKey(KeyCode.Alpha2)) { if (Time.time > spell3CD) { GameObject frostNovaPrefab = AssetDatabase.LoadAssetAtPath("Assets/MagicArsenal/MagicSphereBlast/Prefabs/FrostSphereBlast.prefab", typeof(GameObject)) as GameObject; GameObject go = (GameObject)Instantiate(frostNovaPrefab, transform.position, transform.rotation); FrostNova sft = go.GetComponent <FrostNova>(); sft.initialize(2, 10, 10, 0); spell3CD = Time.time + sft.Cooldown; } } checkBuffs(); }