summaryrefslogtreecommitdiff
path: root/Assembly_CSharp/GamePlay
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2023-11-27 00:08:06 +0800
committerchai <215380520@qq.com>2023-11-27 00:08:06 +0800
commitd4af52c91a717d0ee324f81ad5a673d4a6ba9207 (patch)
treebdb610929b8cd3064632f12479cd47c16b752045 /Assembly_CSharp/GamePlay
parentb45e22c164fa364263b00ce82842999f8e5976b2 (diff)
*move
Diffstat (limited to 'Assembly_CSharp/GamePlay')
-rw-r--r--Assembly_CSharp/GamePlay/BiPlane.cs161
-rw-r--r--Assembly_CSharp/GamePlay/Encampment.cs26
-rw-r--r--Assembly_CSharp/GamePlay/Explosion.cs27
-rw-r--r--Assembly_CSharp/GamePlay/ParticleBeam.cs19
-rw-r--r--Assembly_CSharp/GamePlay/Projectile.cs141
-rw-r--r--Assembly_CSharp/GamePlay/ProjectileFX.cs47
-rw-r--r--Assembly_CSharp/GamePlay/Sawblade.cs87
-rw-r--r--Assembly_CSharp/GamePlay/SnowFlake.cs23
8 files changed, 0 insertions, 531 deletions
diff --git a/Assembly_CSharp/GamePlay/BiPlane.cs b/Assembly_CSharp/GamePlay/BiPlane.cs
deleted file mode 100644
index bcf32e5..0000000
--- a/Assembly_CSharp/GamePlay/BiPlane.cs
+++ /dev/null
@@ -1,161 +0,0 @@
-using UnityEngine;
-
-public class BiPlane : MonoBehaviour
-{
- [SerializeField]
- private TowerType towerType;
-
- [SerializeField]
- private float speed;
-
- [SerializeField]
- private float turnTime = 3f;
-
- [SerializeField]
- private float minDistance = 3f;
-
- [SerializeField]
- private float maxDistance = 12f;
-
- [SerializeField]
- private float attackDistance = 6f;
-
- public GameObject target;
-
- private int directionMultiplier = 1;
-
- private Vector3 previousPos;
-
- private bool flyingTowards = true;
-
- private float desiredAltitude = 5f;
-
- private float desiredTilt;
-
- public int damage;
-
- public int healthDamage;
-
- public int armorDamage;
-
- public int shieldDamage;
-
- public float rps;
-
- public float slowPercent;
-
- public float bleedPercent;
-
- public float burnPercent;
-
- public float poisonPercent;
-
- public float critChance;
-
- public float stunChance;
-
- private int ammo;
-
- [SerializeField]
- private int maxAmmo = 20;
-
- private float timeOfLastShot;
-
- [SerializeField]
- private LayerMask bulletHitMask;
-
- [SerializeField]
- private GameObject projectile;
-
- [SerializeField]
- private float projectileSpeed;
-
- [SerializeField]
- private Transform muzzle;
-
- [SerializeField]
- private Transform artTransform;
-
- private void Start()
- {
- ammo = maxAmmo;
- }
-
- private void Update()
- {
- FlightPath();
- }
-
- private void FixedUpdate()
- {
- }
-
- private void FlightPath()
- {
- Vector3 vector;
- if (target != null)
- {
- vector = target.transform.position;
- }
- else
- {
- vector = Vector3.zero;
- vector.y = 5f;
- }
- if (Vector3.SqrMagnitude(vector - base.transform.position) <= minDistance * minDistance)
- {
- flyingTowards = false;
- Reload();
- }
- else if (Vector3.SqrMagnitude(vector - base.transform.position) >= maxDistance * maxDistance)
- {
- flyingTowards = true;
- }
- float num = ((!flyingTowards) ? 0f : Vector2.SignedAngle(new Vector2(base.transform.forward.x, base.transform.forward.z), new Vector2(vector.x - base.transform.position.x, vector.z - base.transform.position.z)));
- float num2;
- if (target != null && flyingTowards && Vector3.SqrMagnitude(vector - base.transform.position) <= attackDistance * attackDistance)
- {
- desiredAltitude += (Mathf.Min(vector.y, 1f) - desiredAltitude) * Time.deltaTime * 1.5f;
- num2 = base.transform.position.y - desiredAltitude;
- if (Mathf.Abs(num) < 22.5f)
- {
- Fire();
- }
- }
- else
- {
- desiredAltitude += (5f - desiredAltitude) * Time.deltaTime * 3f;
- num2 = base.transform.position.y - desiredAltitude;
- }
- num = Mathf.Clamp(num * 6f, -90f, 90f);
- num2 = Mathf.Clamp(num2 * 6f, -45f, 45f);
- base.transform.Rotate(new Vector3(0f, (0f - num) * Time.deltaTime / turnTime, 0f));
- base.transform.eulerAngles = new Vector3(num2, base.transform.eulerAngles.y, 0f);
- base.transform.Translate(Vector3.forward * Time.deltaTime * speed);
- desiredTilt += (num - desiredTilt) * Time.deltaTime;
- artTransform.eulerAngles = new Vector3(base.transform.eulerAngles.x, base.transform.eulerAngles.y, desiredTilt);
- }
-
- private void Reload()
- {
- ammo = maxAmmo;
- }
-
- private void Fire()
- {
- if (ammo > 0 && timeOfLastShot + rps <= Time.time)
- {
- ammo--;
- timeOfLastShot = Time.time;
- LaunchProjectile();
- }
- }
-
- private void LaunchProjectile()
- {
- Vector3 position = target.transform.position;
- position += new Vector3(Random.Range(-0.33f, 0.33f) + Random.Range(-0.33f, 0.33f), Random.Range(-0.33f, 0.33f) + Random.Range(-0.33f, 0.33f), Random.Range(-0.33f, 0.33f) + Random.Range(-0.33f, 0.33f));
- muzzle.LookAt(position);
- Object.Instantiate(projectile, muzzle.position, muzzle.rotation).GetComponent<Projectile>().SetStats(towerType, target, projectileSpeed, damage, healthDamage, armorDamage, shieldDamage, slowPercent, bleedPercent, burnPercent, poisonPercent, critChance, stunChance);
- }
-}
diff --git a/Assembly_CSharp/GamePlay/Encampment.cs b/Assembly_CSharp/GamePlay/Encampment.cs
deleted file mode 100644
index eaa8ab7..0000000
--- a/Assembly_CSharp/GamePlay/Encampment.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using UnityEngine;
-
-public class Encampment : Dropper
-{
- protected override void Fire()
- {
- if (consumesMana)
- {
- int manaCost = (int)((float)base.damage * manaConsumptionRate);
- if (!ResourceManager.instance.CheckMana(manaCost))
- {
- return;
- }
- ResourceManager.instance.SpendMana(manaCost);
- }
- if (dropPoints.Length != 0)
- {
- Vector2 vector = dropPoints[Random.Range(0, dropPoints.Length)];
- Vector3 endPosition = new Vector3(vector.x + Random.Range(-0.125f, 0.125f) + base.transform.position.x, 0f, vector.y + Random.Range(-0.125f, 0.125f) + base.transform.position.z);
- GameObject obj = Object.Instantiate(projectile, base.transform.position, Quaternion.identity);
- obj.GetComponent<Projectile>().SetStats(towerType, null, projectileSpeed, base.damage, base.healthDamage, base.armorDamage, base.shieldDamage, base.slowPercent, base.bleedPercent, base.burnPercent, base.poisonPercent, base.critChance, base.stunChance);
- obj.GetComponent<Landmine>().blastRadius = base.blastRadius;
- obj.GetComponent<Landmine>().SetEndPosition(endPosition);
- }
- }
-}
diff --git a/Assembly_CSharp/GamePlay/Explosion.cs b/Assembly_CSharp/GamePlay/Explosion.cs
deleted file mode 100644
index a01aa17..0000000
--- a/Assembly_CSharp/GamePlay/Explosion.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using UnityEngine;
-
-public class Explosion : MonoBehaviour
-{
- [SerializeField]
- private float duration = 2f;
-
- [SerializeField]
- private Sound sound;
-
- private void Start()
- {
- if (sound != 0)
- {
- SFXManager.instance.PlaySound(sound, base.transform.position);
- }
- }
-
- private void FixedUpdate()
- {
- duration -= Time.fixedDeltaTime;
- if (duration <= 0f)
- {
- Object.Destroy(base.gameObject);
- }
- }
-}
diff --git a/Assembly_CSharp/GamePlay/ParticleBeam.cs b/Assembly_CSharp/GamePlay/ParticleBeam.cs
deleted file mode 100644
index 6a7bf2a..0000000
--- a/Assembly_CSharp/GamePlay/ParticleBeam.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using UnityEngine;
-
-public class ParticleBeam : Projectile
-{
- [SerializeField]
- private GameObject beamTrail;
-
- protected override void MoveProjectile()
- {
- base.MoveProjectile();
- beamTrail.transform.position = base.transform.position + new Vector3(Random.Range(-1f, 1f), Random.Range(0f, 1f), Random.Range(-1f, 1f));
- }
-
- protected new virtual void OnHit(RaycastHit hit)
- {
- beamTrail.transform.position = hit.point;
- base.OnHit(hit);
- }
-}
diff --git a/Assembly_CSharp/GamePlay/Projectile.cs b/Assembly_CSharp/GamePlay/Projectile.cs
deleted file mode 100644
index 3c15fe4..0000000
--- a/Assembly_CSharp/GamePlay/Projectile.cs
+++ /dev/null
@@ -1,141 +0,0 @@
-using UnityEngine;
-
-public class Projectile : MonoBehaviour
-{
- [SerializeField]
- protected Sound launchSound;
-
- [SerializeField]
- protected Sound hitSound;
-
- protected TowerType shotBy;
-
- [SerializeField]
- protected LayerMask layermask;
-
- [SerializeField]
- protected float speed;
-
- [SerializeField]
- protected bool homing;
-
- [SerializeField]
- protected float maximumLifeTime = 10f;
-
- [SerializeField]
- public GameObject detachOnDestruction;
-
- [SerializeField]
- public ProjectileFX extraFX;
-
- protected GameObject target;
-
- protected int damage;
-
- protected int healthDamage;
-
- protected int armorDamage;
-
- protected int shieldDamage;
-
- protected float slowPercent;
-
- protected float bleedPercent;
-
- protected float burnPercent;
-
- protected float poisonPercent;
-
- protected float critChance;
-
- protected float stunChance;
-
- protected virtual void Start()
- {
- if (launchSound != 0)
- {
- SFXManager.instance.PlaySound(launchSound, base.transform.position);
- }
- }
-
- protected virtual void FixedUpdate()
- {
- maximumLifeTime -= Time.fixedDeltaTime;
- if (maximumLifeTime < 0f)
- {
- Object.Destroy(base.gameObject);
- }
- CheckForHits();
- MoveProjectile();
- if (homing)
- {
- AlterCourse();
- }
- }
-
- public virtual void SetStats(TowerType whoShotMe, GameObject _target, float spd, int dmg, int healthDmg, int armorDmg, int shieldDmg, float slow, float bleed, float burn, float poison, float crit, float stun)
- {
- shotBy = whoShotMe;
- target = _target;
- speed = spd;
- damage = dmg;
- healthDamage = healthDmg;
- armorDamage = armorDmg;
- shieldDamage = shieldDmg;
- slowPercent = slow;
- bleedPercent = bleed;
- burnPercent = burn;
- poisonPercent = poison;
- critChance = crit;
- stunChance = stun;
- }
-
- protected virtual void MoveProjectile()
- {
- base.transform.Translate(Vector3.forward * speed * Time.fixedDeltaTime);
- }
-
- protected virtual void AlterCourse()
- {
- if (!(target == null))
- {
- Quaternion rotation = Quaternion.LookRotation(0.25f * Vector3.up + target.transform.position - base.transform.position, Vector3.up);
- base.transform.rotation = rotation;
- }
- }
-
- protected virtual void CheckForHits()
- {
- if (Physics.Raycast(base.transform.position, base.transform.forward, out var hitInfo, speed * Time.fixedDeltaTime, layermask, QueryTriggerInteraction.Collide))
- {
- OnHit(hitInfo);
- }
- }
-
- protected virtual void OnHit(RaycastHit hit)
- {
- IDamageable component = hit.transform.GetComponent<IDamageable>();
- if (component != null)
- {
- DealDamage(component);
- }
- if (detachOnDestruction != null)
- {
- detachOnDestruction.transform.parent = null;
- }
- if (extraFX != null)
- {
- extraFX.OnDetach();
- }
- Object.Destroy(base.gameObject);
- }
-
- protected virtual void DealDamage(IDamageable target)
- {
- target.TakeDamage(shotBy, damage, healthDamage, armorDamage, shieldDamage, slowPercent, bleedPercent, burnPercent, poisonPercent, critChance, stunChance);
- if (hitSound != 0)
- {
- SFXManager.instance.PlaySound(hitSound, base.transform.position);
- }
- }
-}
diff --git a/Assembly_CSharp/GamePlay/ProjectileFX.cs b/Assembly_CSharp/GamePlay/ProjectileFX.cs
deleted file mode 100644
index df82c3d..0000000
--- a/Assembly_CSharp/GamePlay/ProjectileFX.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using System.Collections;
-using UnityEngine;
-
-public class ProjectileFX : MonoBehaviour
-{
- [SerializeField]
- private GameObject bleedingPS;
-
- [SerializeField]
- private GameObject burrningPS;
-
- [SerializeField]
- private GameObject poisonPS;
-
- public void SetFX(float bleeding, float burning, float poison, float slow, bool arcane)
- {
- if (OptionsMenu.instance.extraProjectileEffects)
- {
- if (bleeding > 0f)
- {
- bleedingPS.SetActive(value: true);
- }
- if (burning > 0f)
- {
- burrningPS.SetActive(value: true);
- }
- if (poison > 0f)
- {
- poisonPS.SetActive(value: true);
- }
- }
- }
-
- public void OnDetach()
- {
- StartCoroutine(Die());
- }
-
- private IEnumerator Die()
- {
- bleedingPS.GetComponent<ParticleSystem>().Stop(withChildren: true);
- burrningPS.GetComponent<ParticleSystem>().Stop(withChildren: true);
- poisonPS.GetComponent<ParticleSystem>().Stop(withChildren: true);
- yield return new WaitForSeconds(1.1f);
- Object.Destroy(base.gameObject);
- }
-}
diff --git a/Assembly_CSharp/GamePlay/Sawblade.cs b/Assembly_CSharp/GamePlay/Sawblade.cs
deleted file mode 100644
index 19038df..0000000
--- a/Assembly_CSharp/GamePlay/Sawblade.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-using System.Collections.Generic;
-using UnityEngine;
-
-public class Sawblade : Projectile
-{
- private Pathfinder targetPathfinder;
-
- private Waypoint nextWaypoint;
-
- private bool pathMode;
-
- private HashSet<Collider> targetsHit = new HashSet<Collider>();
-
- public override void SetStats(TowerType whoShotMe, GameObject _target, float spd, int dmg, int healthDmg, int armorDmg, int shieldDmg, float slow, float bleed, float burn, float poison, float crit, float stun)
- {
- base.SetStats(whoShotMe, _target, spd, dmg, healthDmg, armorDmg, shieldDmg, slow, bleed, burn, poison, crit, stun);
- targetPathfinder = target.GetComponent<Pathfinder>();
- nextWaypoint = targetPathfinder.currentWaypoint;
- }
-
- protected override void AlterCourse()
- {
- if (!pathMode && targetPathfinder != null)
- {
- nextWaypoint = targetPathfinder.currentWaypoint;
- }
- if (!pathMode && (target == null || Vector3.SqrMagnitude(target.transform.position - base.transform.position) < 0.125f))
- {
- nextWaypoint = GetPreviousWaypoint();
- pathMode = true;
- }
- Vector3 position;
- if (!pathMode)
- {
- position = target.transform.position;
- }
- else
- {
- if (Vector3.SqrMagnitude(nextWaypoint.transform.position - base.transform.position) < 0.125f)
- {
- nextWaypoint = GetPreviousWaypoint();
- }
- position = nextWaypoint.transform.position;
- }
- Quaternion rotation = Quaternion.LookRotation(position - base.transform.position, Vector3.up);
- base.transform.rotation = rotation;
- }
-
- protected override void CheckForHits()
- {
- Collider[] array = Physics.OverlapBox(base.transform.position, Vector3.one * 0.25f, Quaternion.identity, layermask, QueryTriggerInteraction.Collide);
- foreach (Collider collider in array)
- {
- if (!pathMode && collider.gameObject == target)
- {
- nextWaypoint = GetPreviousWaypoint();
- pathMode = true;
- }
- if (targetsHit.Contains(collider))
- {
- continue;
- }
- IDamageable component = collider.GetComponent<IDamageable>();
- if (component != null)
- {
- DealDamage(component);
- damage--;
- if (damage <= 0)
- {
- Object.Destroy(base.gameObject);
- }
- }
- targetsHit.Add(collider);
- }
- }
-
- private Waypoint GetPreviousWaypoint()
- {
- Waypoint[] previousWaypoints = nextWaypoint.GetPreviousWaypoints();
- if (previousWaypoints.Length == 0)
- {
- Object.Destroy(base.gameObject);
- return nextWaypoint;
- }
- return previousWaypoints[Random.Range(0, previousWaypoints.Length)];
- }
-}
diff --git a/Assembly_CSharp/GamePlay/SnowFlake.cs b/Assembly_CSharp/GamePlay/SnowFlake.cs
deleted file mode 100644
index 238b829..0000000
--- a/Assembly_CSharp/GamePlay/SnowFlake.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using UnityEngine;
-
-public class SnowFlake : Projectile
-{
- protected override void Start()
- {
- base.Start();
- base.transform.Translate(new Vector3(Random.Range(-0.25f, 0.25f), Random.Range(-0.25f, 0.25f), Random.Range(-0.25f, 0.25f)));
- }
-
- protected override void MoveProjectile()
- {
- base.transform.Translate(Vector3.down * speed * Time.fixedDeltaTime);
- }
-
- protected override void CheckForHits()
- {
- if (Physics.SphereCast(base.transform.position, 0.125f, Vector3.down, out var hitInfo, speed * Time.fixedDeltaTime, layermask, QueryTriggerInteraction.Collide))
- {
- OnHit(hitInfo);
- }
- }
-}