// ================== Generic Attacks ================== protected void RunAttack(AttackTime time, Attack a) { switch (a.type) { case AttackType.SPIN: SpinAttack(time, a); break; case AttackType.TARGET_PLAYER: TargetPlayerAttack(time, a); break; case AttackType.CIRCLE_BURST: CircleBurstAttack(time, a); break; case AttackType.DIRECTIONAL_BURST: DirectionalBurstAttack(time, a); break; case AttackType.CUSTOM: CustomAttack(time, a); break; } }
protected virtual void StepIntoPhase() { expectedPhaseTime = -1; waitTime = -1; phaseTime = 0; if (phase >= phases.Length) { return; } PhaseInfo info = phases[phase]; times = new AttackTime[info.attacks.Length]; for (int i = 0; i < times.Length; i++) { times[i] = new AttackTime(); } Wait(info.wait); Expect(info.expected); }
protected virtual void CustomAttack(AttackTime time, Attack a) { }
protected void DirectionalBurstAttack(AttackTime time, Attack a) { time.Deduct(a.delay, i => SpawnDirectionalBurst(a.bulletSpeed, targets[a.start].transform.position, (a.offset + (float)i * a.rotation * a.delay) * Mathf.Deg2Rad, a.spread * Mathf.Deg2Rad, a.color, a.size)); }
protected void CircleBurstAttack(AttackTime time, Attack a) { time.Deduct(a.delay, i => SpawnCircleBurst(a.bulletSpeed, targets[a.start].transform.position, (float)i * a.rotation + (i % 2) * a.offset, a.spread, a.color, a.size)); }
protected void TargetPlayerAttack(AttackTime time, Attack a) { time.Deduct(a.delay, i => SpawnPlayerTrackingBullet(a.bulletSpeed, targets[a.start].transform.position, a.color, a.size)); }
protected void SpinAttack(AttackTime time, Attack a) { time.Deduct(a.delay, i => SpawnBullet((float)i * a.rotation + a.offset, a.bulletSpeed, targets[a.start].transform.position, a.color, a.size)); }