//Sets health, speed, finds it's own radars and weapons and targets player. void Start() { this.playerShip = GameObject.Find("PlayerShip"); this.enemyHitPoints = 500f; this.enemyShipSpeed = 2f; this.targetRadar = GetComponentInChildren <TargetRadar> (); this.laser1 = GetComponentInChildren <Laser> (); this.laser2 = GetComponentInChildren <LaserLeft> (); this.doomLaser = GetComponentInChildren <DoomLaser> (); this.missileLauncher1 = GetComponentInChildren <MissileLauncher> (); this.missileLauncher2 = GetComponentInChildren <MissileLeft> (); }
//Sets health, speed, finds it's own radars and weapons and targets player. void Start() { this.playerShip = GameObject.Find("PlayerShip"); this.radar = GetComponentInChildren <Radar> (); this.targetRadar = GetComponentInChildren <TargetRadar> (); this.laser1 = GetComponentInChildren <Laser> (); this.laser2 = GetComponentInChildren <LaserLeft> (); this.carrierSubSpawner = GetComponentInChildren <CarrierSubSpawner> (); this.fanaticSpawner = GetComponentInChildren <FanaticSpawner> (); this.doomLaser = GetComponentInChildren <DoomLaser> (); this.enemyHitPoints = 1000f; this.enemyShipSpeed = 3f; }
// Update is called once per frame void Update() { secondsUntilDoom -= Time.deltaTime * timeIncreaseFactor; if (DoomLaser == null) { DoomLaser = FindObjectOfType <DoomLaser>(); } secondsUntilDoom = Mathf.Max(secondsUntilDoom, 0); if (secondsUntilDoom < 1200 && DoomLaser.doomLaserStage == DoomLaserStages.Dormant) { iTween.PunchScale(doomTimerText.gameObject, new Vector3(1, 1, 1), 2f); DoomLaser.AdvanceStage(); } if (secondsUntilDoom < 960 && DoomLaser.doomLaserStage == DoomLaserStages.Stage1) { iTween.PunchScale(doomTimerText.gameObject, new Vector3(1.5f, 1.5f, 1.5f), 2f); DoomLaser.AdvanceStage(); } if (secondsUntilDoom < 720 && DoomLaser.doomLaserStage == DoomLaserStages.Stage2) { iTween.PunchScale(doomTimerText.gameObject, new Vector3(2, 2, 2), 2f); DoomLaser.AdvanceStage(); } if (secondsUntilDoom < 500 && DoomLaser.doomLaserStage == DoomLaserStages.Stage3) { iTween.PunchScale(doomTimerText.gameObject, new Vector3(2.5f, 2.5f, 2.5f), 2f); DoomLaser.AdvanceStage(); } if (secondsUntilDoom < 240 && DoomLaser.doomLaserStage == DoomLaserStages.Stage4) { iTween.PunchScale(doomTimerText.gameObject, new Vector3(3, 3, 3), 2f); DoomLaser.AdvanceStage(); } if (secondsUntilDoom <= 0 && DoomLaser.doomLaserStage == DoomLaserStages.Firing) { iTween.PunchScale(doomTimerText.gameObject, new Vector3(4, 4, 4), 1f); DoomLaser.AdvanceStage(); } int hours = (Mathf.FloorToInt(secondsUntilDoom)) / 3600; int minutes = ((Mathf.FloorToInt(secondsUntilDoom)) % 3600) / 60; int seconds = (Mathf.FloorToInt(secondsUntilDoom)) % 60; doomTimerText.text = string.Format("Time until laser fires \n {0}:{1}:{2}", hours, minutes, seconds); }