// Use this for initialization void OnEnable() { enemyHealth = 3; TimeSpawned = Time.time; shootTimer = Time.time - 3f; thePool = GameObject.Find("PoolManager"); PoolScript = thePool.GetComponent <thepool> (); GameObject scoreKeeperObject = GameObject.FindWithTag("ScoreKeeper"); if (scoreKeeperObject != null) { scoreKeeper = scoreKeeperObject.GetComponent <ScoreKeeper> (); } else { //Debug.Log ("Can't find 'ScoreKeeper' script"); } dropPowerupScript = gameManager.GetComponent <DropPowerup> (); }
// Use this for initialization void OnEnable() { speed = 2f; enemyHealth = 3; thePool = GameObject.Find("PoolManager"); PoolScript = thePool.GetComponent <thepool> (); enemyHealth = enemyHealth * hpMultiplyer; pathNum = Random.Range(1, 9); /*if (scoreKeeper.GetComponent<ScoreKeeper> ().score > 500) { * pathNum = Random.Range (1,9); * }*/ //pathNum = 8; TimeSpawned = Time.time; shootTimer = Time.time; corner1 = transform.FindChild("top"); corner2 = transform.FindChild("left"); corner3 = transform.FindChild("right"); if (pathNum == 1) { speed += 2f; } if (pathNum == 2) { transform.position = new Vector2(12, 7); speed += 1f; } if (pathNum == 3) { transform.position = new Vector2(10, 7); speed += 2f; } if (pathNum == 4) { transform.position = new Vector2(-10, -10.5f); speed += 2f; } //topleft to botright if (pathNum == 5) { transform.position = new Vector2(-19, 9); } //botright to top left if (pathNum == 6) { transform.position = new Vector2(19, -9); } if (pathNum == 7) { transform.position = new Vector2(19, 9); } if (pathNum == 8) { transform.position = new Vector2(-19, -9); } GameObject scoreKeeperObject = GameObject.FindWithTag("ScoreKeeper"); if (scoreKeeperObject != null) { scoreKeeper = scoreKeeperObject.GetComponent <ScoreKeeper> (); } if (scoreKeeper == null) { //Debug.Log ("Can't find 'ScoreKeeper' script"); } dropPowerupScript = gameManager.GetComponent <DropPowerup> (); }