using System.Collections; using System.Collections.Generic; using UnityEngine; public class KuubikuHoidla : MonoBehaviour { public GameObject[,] hoidla=new GameObject[11, 15]; //x 0..10, y 0..15 void Start() { Debug.Log(KasVaba(0, 0)); GameObject uus=GameObject.CreatePrimitive(PrimitiveType.Cube); uus.transform.position=new Vector3(1, 2, 0); this.Paiguta(1, 2, uus); Debug.Log(KasVaba(1, 2)); Debug.Log(hoidla[1, 2].transform.position.x); } public bool KasSobib(KukkuvKujund kujund){ int x=(int)Mathf.Round(kujund.asukohad[0].transform.position.x); int y=(int)Mathf.Round(kujund.asukohad[0].transform.position.y); return KasVaba(x, y); } bool KasVaba(int x, int y){ if(y<0){return false;} return hoidla[x, y]==null; } public void Paiguta(int x, int y, GameObject obj){ hoidla[x, y]=obj; } void Update() { } }