void Start() { openPowerUpPositions.Clear(); foreach (Transform position in transform.Find("Positions")) { PowerUpPosition powerUpPosition = position.GetComponent <PowerUpPosition>(); if (!powerUpPosition.IsTaken()) { openPowerUpPositions.Add(powerUpPosition); } } }
void OnTriggerEnter2D(Collider2D collision) { Player player = collision.gameObject.GetComponent <Player>(); PowerUpPosition powerUpPosition = powerUpPositionObject.GetComponent <PowerUpPosition>(); if (player) { if (!powerUpPosition.IsTaken()) { // Fleet fleet = player.GetComponent<Entity>().affinity.GetComponent<Fleet>(); // GameObject minionFormation = fleet.AddMinionFormation(level); // minionFormation.transform.position = powerUpPosition.transform.position; powerUpPosition.TakePosition(); } DestroyMe(); } }