void SpawnCharacters()
    {
        Vector3Int position     = tilemapInfo.GetTopCorner();
        GameObject characterObj = Instantiate(characterPrefab, position, Quaternion.identity);

        characterObj.transform.SetParent(this.transform);
        Character character = characterObj.GetComponent <Character>();

        character.OnInitializedSpawnAtTilePosition(position);
    }
Exemple #2
0
    void InitializeTowerPositions()
    {
        Vector3Int center       = tilemapInfo.GetCenter();
        Vector3Int bottomCorner = tilemapInfo.GetBottomCorner();
        Vector3Int topCorner    = tilemapInfo.GetTopCorner();

        towerPositions = new Dictionary <TowerLocation, Vector3Int> {
            { TowerLocation.NW, new Vector3Int(center.x, topCorner.y - 1, 0) },    //NW
            { TowerLocation.NE, new Vector3Int(topCorner.x - 1, center.y, 0) },    //NE
            { TowerLocation.CENTER, center },
            { TowerLocation.SW, new Vector3Int(bottomCorner.x + 1, center.y, 0) }, //SW
            { TowerLocation.SE, new Vector3Int(center.x, bottomCorner.y + 1, 0) } //SE
        };
    }
 public void MoveToTopCorner()
 {
     MoveToTilePosition(tilemapInfo.GetTopCorner());
 }