From 4c1aae4b22c0dcb8c67a785df6b7a7492739b8d8 Mon Sep 17 00:00:00 2001 From: "falc@null.net" Date: Sat, 29 Oct 2016 03:58:20 +0200 Subject: [PATCH] Mix it, fam --- Assets/MapCreation.cs | 35 +++++++++++++++++++++++++++++++++++ Assets/MapCreation.cs.meta | 12 ++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 Assets/MapCreation.cs create mode 100644 Assets/MapCreation.cs.meta diff --git a/Assets/MapCreation.cs b/Assets/MapCreation.cs new file mode 100644 index 0000000..e4d39b5 --- /dev/null +++ b/Assets/MapCreation.cs @@ -0,0 +1,35 @@ +using UnityEngine; +using System.Collections; + +public class MapCreation : MonoBehaviour { + + public int vs = 20; + public int hs = 40; + public int[,] matrix; //0 significa zona habitable + //dif de 0 zona no habitable + public GameObject basic_floor; + public GameObject nhabitable_floor; + + + void Start () { + GameObject basic_floor_instance; + for(int i = 0; i < vs; i++){ + for(int j = 0; j < hs; j++){ + if(matrix[i,j]==0) basic_floor_instance = Instantiate(basic_floor, new Vector3(i,-0.5f,j), Quaternion.identity) as GameObject; + else basic_floor_instance = Instantiate(nhabitable_floor, new Vector3(i,0.5f,j), Quaternion.identity) as GameObject; + } + } + } + + + void Update () { + + } + + + void setMatrix(int[,] new_floor, int x, int z){ + matrix = new_floor; + vs = x; + hs = z; + } +} diff --git a/Assets/MapCreation.cs.meta b/Assets/MapCreation.cs.meta new file mode 100644 index 0000000..b16be31 --- /dev/null +++ b/Assets/MapCreation.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6f9a0bb9550360146929761331442cb6 +timeCreated: 1477706051 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: