// Use this for initialization void Start() { animator = GetComponent<Animator>(); waypoints = new DBWaypoint(); rnd = new System.Random(); gameController = GameObject.Find("Game Controller(Clone)"); gameController = GameObject.FindGameObjectWithTag("GameController"); gameControllerScript = gameController.GetComponent<GameController>(); if (gameControllerScript.playerType == "pilot") { player = GameObject.Find("Player(Clone)").GetComponent<Player>(); } projectile = Resources.Load("Projectiles/laserRed", typeof(GameObject)) as GameObject; canTakeDamage = true; #region Set Movementpattern spawnerScript = GameObject.FindGameObjectWithTag("Spawner").GetComponent<Spawner>(); waypoints.SetMovementPattern(spawnerScript.chosenPatternName); currentWaypoint = waypoints.movementPattern[0].position; currentIndex = 0; #endregion NewRound(); #region Shot timer shoot = new Timer(baseShootingSpeed); shoot.Elapsed += new ElapsedEventHandler(CanShoot); shoot.Enabled = true; #endregion #region Invincibility timer hit = new Timer(baseInvincibilityTime); hit.Elapsed += new ElapsedEventHandler(CanTakeDamage); hit.Enabled = false; #endregion }
// Use this for initialization void Start() { health = 30; animator = GetComponent<Animator>(); waypoints = new DBWaypoint(); gameControllerScript = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameController>(); targets = GameObject.FindGameObjectsWithTag("PilotAI"); projectile = Resources.Load("Projectiles/laserRed", typeof(GameObject)) as GameObject; bossProjectile = Resources.Load("Projectiles/bossLaser", typeof(GameObject)) as GameObject; bossGuidedProjectile = Resources.Load("Projectiles/bossLaserRed", typeof(GameObject)) as GameObject; #region Special timer special = new Timer(10000); special.Elapsed += new ElapsedEventHandler(CanSpecial); special.Enabled = true; #endregion #region Shot timer shoot = new Timer(1000); shoot.Elapsed += new ElapsedEventHandler(CanShoot); shoot.Enabled = true; #endregion #region Move timer move = new Timer(5000); move.Elapsed += new ElapsedEventHandler(CanMove); #endregion #region Set Movementpattern waypoints.SetMovementPattern("boss"); currentWaypoint = waypoints.movementPattern[0].position; currentIndex = 0; #endregion #region Invincibility timer hit = new Timer(2000); hit.Elapsed += new ElapsedEventHandler(CanTakeDamage); canTakeDamage = true; #endregion }