Stranar/Assets/Scripts/bombspawner.cs
2022-06-25 15:42:49 +02:00

36 lines
812 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class bombspawner : MonoBehaviour
{
public GameObject totok;
public int maxcubes = 100;
void PlaceObj(){
int x = Random.Range(-821, 1000);
int z = Random.Range(-950, 950);
int y = 800;
//pick y from either -75 and 845
if (Random.Range(0, 2) == 0)
{
y = 1600;
}
GameObject iks = Instantiate(totok.gameObject, new Vector3(x, y, z), Quaternion.identity);
iks.SetActive(true);
} // Start is called before the first frame update
void Start()
{
for (int i = 0; i < maxcubes; i++)
{
PlaceObj();
}
}
// Update is called once per frame
void Update()
{
}
}