void SpawnMinionGuy() //spawning minion { if (player != null) { minonHandler minionPrefab = ((GameObject)Instantiate(minonEnemy, spawnPos, player.rotation)).GetComponent <minonHandler> (); if (spawnPos.x >= 6.5f || spawnPos.x <= -6.5f) { minionPrefab.isOutOfBounds = true; //making the minion move down the right or left of the screen if it is in the right position } } }
// Use this for initialization void Start() { minonHandler minionLeft = ((GameObject)Instantiate(minionPref, new Vector3(transform.position.x + 2f, transform.position.y, transform.position.z), transform.rotation)).GetComponent <minonHandler> (); //spawing left minion minionLeft.leftBoss = true; //setting a bool on the minion to true minionLeft.isWithBoss = true; //a bool that indicates weahter or not the minion is in range to the boss minionLeft.name = "leftMinion"; //setting minion name minonHandler minionRight = ((GameObject)Instantiate(minionPref, new Vector3(transform.position.x - 2f, transform.position.y, transform.position.z), transform.rotation)).GetComponent <minonHandler> (); //spawing right minion minionRight.leftBoss = false; minionRight.isWithBoss = true; minionRight.name = "rightMinion"; spawnEnemy.Instance.spawnNumber += 2; //increasing spawn amount on seperate spawn manager spawnEnemy.Instance.maxEnemies += 2; bar = healthbar.GetComponent <SpriteRenderer>(); //health bar component, rendered as a sprite above the tank lookLocation = GameObject.FindWithTag("LPos").transform; //moving straight at the player healthLook = GameObject.FindWithTag("LookLoc").transform; //far set health look location to orient the bar in the same direction for the whole time }