-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDistributor.cs
More file actions
42 lines (32 loc) · 905 Bytes
/
Distributor.cs
File metadata and controls
42 lines (32 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Distributor : MonoBehaviour
{
public GameObject plano;
public List<GameObject> planos;
public GameObject ancla;
public int distanciaDeCajas, numeroDeCajas;
public Text textDisplay;
// Use this for initialization
void Start ()
{
for (int i = 0; i < numeroDeCajas; i++) {
Vector3 pos = new Vector3 (ancla.transform.position.x + Random.Range (-distanciaDeCajas, distanciaDeCajas),
1,
ancla.transform.position.z + Random.Range (-distanciaDeCajas, distanciaDeCajas));
planos.Add (Instantiate (plano, pos, Quaternion.identity));
}
UpdateText ();
}
public void UpdateText ()
{
textDisplay.text = "SAMPLES " + (planos.Count).ToString ();
}
public void Remove (GameObject g)
{
planos.Remove (g);
UpdateText ();
}
}