diff options
author | chai <215380520@qq.com> | 2023-11-25 18:39:02 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2023-11-25 18:39:02 +0800 |
commit | 0e63c4a2c6dec8dfa260501fb7d73750261ea7b7 (patch) | |
tree | f6f2291be65d195d6082b523a56183c332715240 /Assembly_CSharp/Morter.cs |
+ init
Diffstat (limited to 'Assembly_CSharp/Morter.cs')
-rw-r--r-- | Assembly_CSharp/Morter.cs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Assembly_CSharp/Morter.cs b/Assembly_CSharp/Morter.cs new file mode 100644 index 0000000..2170da3 --- /dev/null +++ b/Assembly_CSharp/Morter.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +public class Morter : Tower +{ + protected override void AimTurret() + { + } + + protected override void Fire() + { + if (consumesMana) + { + int manaCost = (int)((float)base.damage * finalManaConsumption); + if (!ResourceManager.instance.CheckMana(manaCost)) + { + return; + } + ResourceManager.instance.SpendMana(manaCost); + } + float num = projectileSpeed * Mathf.Clamp(Vector3.SqrMagnitude(currentTarget.transform.position - base.transform.position) / (2f * baseRange * baseRange), 1f, float.MaxValue); + Vector3 vector = currentTarget.GetComponent<Enemy>().GetFuturePosition(num) - turret.transform.position; + GameObject gameObject = Object.Instantiate(rotation: Quaternion.LookRotation(new Vector3(vector.x, 0f, vector.z), Vector3.up), original: projectile, position: muzzle.position); + gameObject.GetComponent<Projectile>().SetStats(towerType, currentTarget, num, base.damage, base.healthDamage, base.armorDamage, base.shieldDamage, base.slowPercent, base.bleedPercent, base.burnPercent, base.poisonPercent, base.critChance, base.stunChance); + gameObject.GetComponent<MorterShell>().SetMorterPhysics(currentTarget.GetComponent<Enemy>().GetFuturePosition(num)); + gameObject.GetComponent<MorterShell>().blastRadius = base.blastRadius; + if (extraProjectileFX != null) + { + GameObject gameObject2 = Object.Instantiate(extraProjectileFX, gameObject.transform.position, gameObject.transform.rotation); + gameObject2.transform.SetParent(gameObject.transform); + gameObject2.GetComponent<ProjectileFX>().SetFX(base.bleedPercent, base.burnPercent, base.poisonPercent, base.slowPercent, consumesMana); + Projectile component = gameObject.GetComponent<Projectile>(); + if (component.detachOnDestruction == null) + { + component.detachOnDestruction = gameObject2; + component.extraFX = gameObject2.GetComponent<ProjectileFX>(); + } + } + } +} |