1
Fork 0
mirror of https://github.com/Steffo99/keep-everything-alive.git synced 2024-11-25 18:54:19 +00:00
keep-everything-alive/Assets/Scripts/Microgame_YourShip/SpawnInArea.cs

25 lines
686 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpawnInArea : MonoBehaviour
{
public GameObject instantiate;
public Vector2 min;
public Vector2 max;
public int multiplier;
private GameController gameController;
private void Awake() {
gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameController>();
}
private void Start()
{
for(int i = 0; i < gameController.Difficulty * multiplier; i++) {
Instantiate(instantiate, new Vector2(Random.Range(min.x, max.x), Random.Range(min.y, max.y)), Quaternion.identity, transform);
}
}
}