Mix it, fam
This commit is contained in:
parent
c12595d548
commit
4c1aae4b22
2 changed files with 47 additions and 0 deletions
35
Assets/MapCreation.cs
Normal file
35
Assets/MapCreation.cs
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
12
Assets/MapCreation.cs.meta
Normal file
12
Assets/MapCreation.cs.meta
Normal file
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6f9a0bb9550360146929761331442cb6
|
||||
timeCreated: 1477706051
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in a new issue