generator compiles now
This commit is contained in:
parent
4c1aae4b22
commit
ff75ec9601
2 changed files with 24 additions and 9 deletions
|
@ -4,20 +4,35 @@ using System.Collections;
|
||||||
public class Generator : MonoBehaviour {
|
public class Generator : MonoBehaviour {
|
||||||
|
|
||||||
GameObject tmanager;
|
GameObject tmanager;
|
||||||
GameObject fcreator;
|
GameObject mcreator;
|
||||||
GameObject ucreator;
|
GameObject ucreator;
|
||||||
Component tScript;
|
TurnManagerScript tScript;
|
||||||
Component fScript;
|
MapCreation mScript;
|
||||||
Component uScript;
|
UnitCreator uScript;
|
||||||
|
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
void Start () {
|
void Start () {
|
||||||
GameObject turnMan = Instantiate (tmanager);
|
GameObject turnMan = Instantiate (tmanager);
|
||||||
GameObject floorCreator = Instantiate (fcreator);
|
GameObject mapCreator = Instantiate (mcreator);
|
||||||
GameObject unitCreator = Instantiate (ucreator);
|
GameObject unitCreator = Instantiate (ucreator);
|
||||||
tScript = turnMan.GetComponent ("TurnManagerScript");
|
tScript = turnMan.GetComponent<TurnManagerScript>();
|
||||||
//fScript = floorCreator.GetComponent ("FloorCreatorScript");
|
mScript = mapCreator.GetComponent<MapCreation>();
|
||||||
uScript = unitCreator.GetComponent ("UnitCreator");
|
uScript = unitCreator.GetComponent<UnitCreator>();
|
||||||
|
int x = 20;
|
||||||
|
int y = 40;
|
||||||
|
int[,] map = new int [x,y] ;
|
||||||
|
for(int i = 0; i < x; ++i) {
|
||||||
|
for(int j = 0; j < y; ++j) {
|
||||||
|
if (i == 0 || i == x-1 || j == 0 || j == y-1)
|
||||||
|
map [i, j] = -1;
|
||||||
|
else
|
||||||
|
map [i, j] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//just to test
|
||||||
|
map [10, 10] = -1;
|
||||||
|
map [10, 20] = -1;
|
||||||
|
mScript.setMatrix (map,x,y);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class MapCreation : MonoBehaviour {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void setMatrix(int[,] new_floor, int x, int z){
|
public void setMatrix(int[,] new_floor, int x, int z){
|
||||||
matrix = new_floor;
|
matrix = new_floor;
|
||||||
vs = x;
|
vs = x;
|
||||||
hs = z;
|
hs = z;
|
||||||
|
|
Loading…
Reference in a new issue