blob: e0d8d1db605a29960b27f91678f6a22fafbcb876 (
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
using UnityEngine;
public class RadarTower : Tower
{
[SerializeField]
private GameObject biPlanePrefab;
[SerializeField]
private BiPlane myPlane;
protected override void Start()
{
if (myPlane == null)
{
myPlane = Object.Instantiate(biPlanePrefab, base.transform.position + new Vector3(-50f, 5f, 0f), Quaternion.identity).GetComponent<BiPlane>();
}
base.Start();
}
public override void SetStats()
{
base.SetStats();
if (myPlane == null)
{
myPlane = Object.Instantiate(biPlanePrefab, base.transform.position + new Vector3(-50f, 5f, 0f), Quaternion.identity).GetComponent<BiPlane>();
}
myPlane.damage = base.damage;
myPlane.healthDamage = base.healthDamage;
myPlane.armorDamage = base.armorDamage;
myPlane.shieldDamage = base.shieldDamage;
myPlane.rps = rps;
myPlane.slowPercent = base.slowPercent;
myPlane.bleedPercent = base.bleedPercent;
myPlane.burnPercent = base.burnPercent;
myPlane.poisonPercent = base.poisonPercent;
myPlane.critChance = base.critChance;
myPlane.stunChance = base.stunChance;
}
protected override void Update()
{
if (currentTarget != null)
{
if (turret != null)
{
AimTurret();
}
GainXP();
}
timeSinceLastShot += Time.deltaTime;
if (currentTarget != null && timeSinceLastShot > 3f)
{
SendTargetInfo(currentTarget);
timeSinceLastShot = 0f;
}
}
private void SendTargetInfo(GameObject target)
{
if (myPlane.target == null)
{
myPlane.target = target;
}
}
public override void Demolish()
{
Object.Destroy(myPlane.gameObject);
base.Demolish();
}
}
|