blob: 2b087fd9fed7b63ca894d44715caad3c66195bd9 (
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
|
using UnityEngine;
public class Mill_ImprovementExplosiveTrap : MonoBehaviour, DayNightCycle.IDaytimeSensitive
{
[SerializeField]
private Weapon weaponLvl1;
[SerializeField]
private Weapon weaponLvl2;
[SerializeField]
private Weapon weaponLvl3;
[SerializeField]
private Hp hpOfBuilding;
[SerializeField]
private BuildSlot buildSlot;
public Mesh lvl2Mesh;
public Mesh lvl3Mesh;
private void Start()
{
DayNightCycle.Instance.RegisterDaytimeSensitiveObject(this);
}
public void OnDawn_AfterSunrise()
{
}
public void OnDawn_BeforeSunrise()
{
}
public void OnDusk()
{
SetCorrectWeapon();
}
private void OnEnable()
{
buildSlot.upgrades[1].upgradeBranches[0].replacementMesh = lvl2Mesh;
buildSlot.upgrades[2].upgradeBranches[0].replacementMesh = lvl3Mesh;
SetCorrectWeapon();
}
private void SetCorrectWeapon()
{
if (buildSlot.Level == 1)
{
hpOfBuilding.SpwanAttackOnDeath = weaponLvl1;
}
else if (buildSlot.Level == 2)
{
hpOfBuilding.SpwanAttackOnDeath = weaponLvl2;
}
else if (buildSlot.Level == 3)
{
hpOfBuilding.SpwanAttackOnDeath = weaponLvl3;
}
}
}
|