void Awake() { base.Awake(); shockwavePrefab = Resources.Load <GameObject>("Prefabs/Shockwave"); trailShotPrefab = Resources.Load <TrailShot>("Prefabs/TrailShot"); rotatingCircleShotPrefab = Resources.Load <RotatingCircleShot>("Prefabs/RotatingCircleShot"); lifeSapZonePrefab = Resources.Load <LifeSapZone>("Prefabs/LifeSapZone"); reflectorPrefab = Resources.Load <Reflector>("Prefabs/Reflector"); }
private SphereCollider[] FindAllLifeSapZones(Collider[] allObjects) { List <SphereCollider> lifeSapZones = new List <SphereCollider>(); for (int i = 0; i < allObjects.Length; i++) { LifeSapZone lifeSapZone = allObjects[i].GetComponentInParent <LifeSapZone>(); if (lifeSapZone != null && lifeSapZone.owningPlayer != ai.thisShip.playerEnum) { lifeSapZones.Add((SphereCollider)allObjects[i]); } } return(lifeSapZones.ToArray()); }
public override void Detonate(AttackButtons attackToPerform) { switch (attackToPerform) { //Trail Shot case AttackButtons.A: TrailShot trailShot = Instantiate(trailShotPrefab, transform.position, new Quaternion()) as TrailShot; trailShot.owningPlayer = owningPlayer; if (!GameManager.S.inGame) { trailShot.thisPlayer = thisPlayer; trailShot.target = thisPlayer.otherPlayer.character.transform; } trailShot.FireBurst(); break; //Rotating Circle shot case AttackButtons.B: RotatingCircleShot rotatingCircleShot = Instantiate(rotatingCircleShotPrefab, transform.position, new Quaternion()) as RotatingCircleShot; rotatingCircleShot.owningPlayer = owningPlayer; if (!GameManager.S.inGame) { rotatingCircleShot.thisPlayer = thisPlayer; } break; //LifeSapZone attack case AttackButtons.X: LifeSapZone lifeSapZone = Instantiate(lifeSapZonePrefab, transform.position, new Quaternion()) as LifeSapZone; if (GameManager.S.inGame) { lifeSapZone.owner = GameManager.S.players[(int)owningPlayer]; } else { lifeSapZone.owner = thisPlayer; } break; //Vampire Shield case AttackButtons.Y: return; default: Debug.LogError("Attack button " + attackToPerform.ToString() + " not handled in Bomb.Detonate()"); break; } //Stop moving the bomb physics.velocity = Vector3.zero; if (GameManager.S.inGame) { SoundManager.instance.Play("BombExplode"); } GameObject shockwave = Instantiate(shockwavePrefab, transform.position, new Quaternion()) as GameObject; Destroy(shockwave, 5f); Destroy(gameObject); }