summaryrefslogtreecommitdiff
path: root/GameCode/Encampment.cs
blob: eaa8ab79cdd675d25e2370f43b0d1eb499952f19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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);
		}
	}
}