private void generate(int number) { for (int i = 0; i < number; i++) { Vector2 pos = board.GridPositionToVector2(board.GetRandomGridPosition()); //Debug.Log(pos); Vector3Int p = new Vector3Int((int)(pos.x + 2), (int)pos.y + 2, 0); //tile.SetColor(p, Color.red); //Debug.Log(tile.GetColor(p)); GameObject x = Instantiate(enemy, p, Quaternion.identity); } for (int i = 0; i < number; i++) { Vector2 pos = board.GridPositionToVector2(board.GetRandomGridPosition()); //Debug.Log(pos); Vector3Int p = new Vector3Int((int)(pos.x + 2), (int)pos.y + 2, 0); //tile.SetColor(p, Color.red); //Debug.Log(tile.GetColor(p)); Instantiate(spawner, p, Quaternion.identity); } for (int i = 0; i < number; i++) { Vector2 pos = board.GridPositionToVector2(board.GetRandomGridPosition()); //Debug.Log(pos); Vector3Int p = new Vector3Int((int)(pos.x + 2), (int)pos.y + 2, 0); //tile.SetColor(p, Color.red); //Debug.Log(tile.GetColor(p)); Instantiate(healthpotion, p, Quaternion.identity); } }
public override void Generate(BoardGenerator boardGenerator) { GridPosition startPos = null; if (useRandomTunnelStartPositions) { startPos = boardGenerator.GetRandomGridPosition(); for (int i = 0; i < numTunnels; i++) { GridPosition randomGoalPosition = boardGenerator.GetRandomGridPosition(); if (spawnRoomsAtTunnelEnds) { SpawnRoomTemplateAtTunnelEnd(boardGenerator, randomGoalPosition); } DigTunnel(boardGenerator, startPos, randomGoalPosition); } } else if (connectLastStrataLayer) { List <GridPosition> goalPositions = BuildTunnelGoalList(boardGenerator); for (int i = 0; i < goalPositions.Count; i++) { startPos = goalPositions[i]; int loopingGoalPositionIndex = ((i + 1) % goalPositions.Count); GridPosition targetPosition = goalPositions[loopingGoalPositionIndex]; DigTunnel(boardGenerator, startPos, targetPosition); } } }
// Use this for initialization void Start() { counter = waveRate; num = 10; board = gameObject.GetComponent <BoardGenerator>(); tile = board.GetComponent <Tilemap>(); //Debug.Log(board); for (int i = 0; i < num; i++) { Vector2 pos = board.GridPositionToVector2(board.GetRandomGridPosition()); //Debug.Log(pos); Vector3Int p = new Vector3Int((int)(pos.x + 2), (int)pos.y + 2, 0); //tile.SetColor(p, Color.red); //Debug.Log(tile.GetColor(p)); Instantiate(enemy, p, Quaternion.identity); } for (int i = 0; i < 5; i++) { Vector2 pos = board.GridPositionToVector2(board.GetRandomGridPosition()); //Debug.Log(pos); Vector3Int p = new Vector3Int((int)(pos.x + 2), (int)pos.y + 2, 0); //tile.SetColor(p, Color.red); //Debug.Log(tile.GetColor(p)); Instantiate(powerpotion, p, Quaternion.identity); } }
//public GameObject room = GameObject.Find("Room"); // Use this for initialization void Start() { board = gameObject.GetComponent <BoardGenerator>(); Debug.Log(board.name); GridPosition doory = board.GetRandomGridPosition(); Vector2 testy = new Vector2(5, 5); Vector2 pos = board.GetDoorPos(); Debug.Log(pos); Instantiate(door, pos, Quaternion.identity); }