Stranar/Assets/Scripts/bombspawner.cs

31 lines
732 B
C#
Raw Normal View History

2022-06-25 15:42:49 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class bombspawner : MonoBehaviour
{
public GameObject totok;
public int maxcubes = 100;
2022-06-27 11:54:53 +02:00
public void PlaceObj(){
2022-06-25 15:42:49 +02:00
int x = Random.Range(-821, 1000);
int z = Random.Range(-950, 950);
2022-06-27 11:54:53 +02:00
int y = Random.Range(-120, 1680);
2022-06-25 15:42:49 +02:00
GameObject iks = Instantiate(totok.gameObject, new Vector3(x, y, z), Quaternion.identity);
iks.SetActive(true);
} // Start is called before the first frame update
2022-06-27 11:54:53 +02:00
public void StartBombs()
2022-06-25 15:42:49 +02:00
{
for (int i = 0; i < maxcubes; i++)
{
PlaceObj();
}
}
// Update is called once per frame
void Update()
{
}
}