1
using System
.Collections
;
2 using System
.Collections
.Generic
;
5 public class BossController
: MonoBehaviour
{
7 private CanRotatorFire rightCanScript
;
8 private CanRotatorFire leftCanScript
;
9 private BossMovement bossMovementScript
;
11 private bool grenadeStart
;
12 private bool chooseOnce
;
13 private bool shootStart
;
14 private bool strikeAttackOn
;
17 public bool strikeAttack
;
18 public bool automated
;
19 public bool onceIdleTimer
;
21 private float grenadeTimestamp
;
22 private float grenadeTimer
;
23 public float idleTimer
;
24 private float idleTimestamp
;
25 private float shootTimestamp
;
26 public float shootTimer
;
28 // Use this for initialization
43 bossMovementScript
= GameObject
.FindGameObjectWithTag ("TanukiSensei").GetComponent
<BossMovement
> ();
44 leftCanScript
= GameObject
.FindGameObjectWithTag ("BossLeftCan").GetComponent
<CanRotatorFire
> ();
45 rightCanScript
= GameObject
.FindGameObjectWithTag ("BossRightCan").GetComponent
<CanRotatorFire
> ();
46 rightCanScript
.isRightCan
= true;
50 // Update is called once per frame
57 if (Time
.time
- idleTimestamp
>= idleTimer
)
61 switch (Random
.Range (0, 3)){
84 if (Time
.time
- shootTimestamp
>= shootTimer
)
86 leftCanScript
.noAimSequence
= false;
87 rightCanScript
.noAimSequence
= false;
97 setGrenadeTimestamp ();
100 if (Time
.time
- grenadeTimestamp
>= grenadeTimer
) {
103 rightCanScript
.grenadeSequence
= false;
104 leftCanScript
.grenadeSequence
= false;
105 bossMovementScript
.fig8Path
= false;
106 bossMovementScript
.hoverPath
= true;
107 onceIdleTimer
= true;
113 bossMovementScript
.hoverPath
= false;
116 if (strikeAttackOn
) {
117 if (!bossMovementScript
.strikeAttack
)
119 onceIdleTimer
= true;
120 strikeAttackOn
= false;
127 //if boss is to the left of the yarn, fire with right can -on
128 if (bossMovementScript
.currentHoverPath
== 0) {
129 leftCanScript
.noAimSequence
= false;
130 rightCanScript
.noAimSequence
= true;
133 leftCanScript
.noAimSequence
= true;
134 rightCanScript
.noAimSequence
= false;
140 bossMovementScript
.hoverPath
= false;
141 bossMovementScript
.hover
= false;
142 bossMovementScript
.fig8Path
= true;
143 leftCanScript
.grenadeSequence
= true;
144 rightCanScript
.grenadeSequence
= true;
147 void setGrenadeTimestamp()
149 grenadeStart
= false;
150 grenadeTimestamp
= Time
.time
;
155 bossMovementScript
.strikeAttack
= true;
156 strikeAttackOn
= true;
157 strikeAttack
= false;
160 void setIdleTimestamp(){
161 idleTimestamp
= Time
.time
;
162 onceIdleTimer
= false;
166 void setShootTimestamp()
168 shootTimestamp
= Time
.time
;