コード例 #1
0
	public void ReplaceTile(int x, int y, GameObject newTile){
		//Debug.Log (x + ", " + y);
		if (_levelGrid [x, y] != null) {
			Destroy (_levelGrid [x, y]);
		}
		_levelGrid [x, y] = Instantiate (newTile, CoordToVector3(x,y, 0), Quaternion.identity) as GameObject;
		levelControllerScript.SetLevelGrid (_levelGrid);
	}
コード例 #2
0
    // Use this for initialization
    void Start () {
		if (xmax % 2 == 0) {oddColAdjustment = -.5f;}
		if (ymax % 2 == 0) {oddRowAdjustment = -.5f;}

		levelControllerScript = GameObject.Find ("LevelController").GetComponent<LevelControllerScript> ();
		ymax = levelControllerScript.GetMapCols ();
		xmax = levelControllerScript.GetMapRows ();
		_levelGrid = levelControllerScript.GetLevelGrid ();

		corridorTile = Resources.Load ("Prefabs/Environment/Corridor") as GameObject;
        floorTile = Resources.Load("Prefabs/Environment/Floor") as GameObject;
        wallTile = Resources.Load("Prefabs/Environment/Wall") as GameObject;
        doorTile = Resources.Load("Prefabs/Environment/Door") as GameObject;
        unusedTile = Resources.Load("Prefabs/Environment/Unused") as GameObject;
        woodWallTile = Resources.Load("Prefabs/Environment/WoodWall") as GameObject;
        //GameObject sut = Instantiate(unusedTile, new Vector3(0, 0, -1), Quaternion.identity) as GameObject;
        //levelControllerScript.ReplaceTile(0, 0, unusedTile);

        CreateDungeon(xmax, ymax, 100);
        //Initialize();
		levelControllerScript.SetLevelGrid(_levelGrid);
    }