Ejemplo n.º 1
0
 // Start is called before the first frame update
 void Start()
 {
     gameManager              = GameManager.Instance;
     gameManager.OnGameStart += OnGameStart;
     tilemapInfo              = TilemapInfo.Instance;
     InitializeTowerPositions();
 }
Ejemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        gameManager              = GameManager.Instance;
        gameManager.OnGameStart += OnGameStart;

        tilemapInfo = TilemapInfo.Instance;
    }
Ejemplo n.º 3
0
 // Start is called before the first frame update
 void Start()
 {
     this.tilemapInfo = TilemapInfo.Instance;
     this.grid        = tilemapInfo.GetGrid();
     this.sprite      = this.GetComponent <Sprite>();
     isInitialized    = true;
 }
Ejemplo n.º 4
0
    void Start()
    {
        tilemapInfo = TilemapInfo.Instance;
        tiles       = Tiles.Instance;
        tilemap     = tilemapInfo.GetTilemap();

        AddDependencies();
    }
Ejemplo n.º 5
0
    /**
     *  Default spawn bounds = tilemap floor size - sprite padding
     */
    void InitDefaultSpawnBounds()
    {
        TilemapInfo tilemapInfo = TilemapInfo.Instance;
        Vector3     bottomLeft  = tilemapInfo.GetWorldCoordinatesOfTilePosition(tilemapInfo.GetBottomLeftCornerTilePosition());
        Vector3     topRight    = tilemapInfo.GetWorldCoordinatesOfTilePosition(tilemapInfo.GetTopRightCornerTilePosition());

        this.minX = bottomLeft.x;
        this.maxX = topRight.x;
        this.minY = bottomLeft.y;
        this.maxY = topRight.y;
    }
Ejemplo n.º 6
0
    // Start is called before the first frame update
    void Start()
    {
        tilemapInfo = TilemapInfo.Instance;
        tilemap     = tilemapInfo.GetTilemap();
        grid        = tilemapInfo.GetGrid();
        tiles       = Tiles.Instance;

        prevHighlightedTile = new PrevHighlightedTile();
        int numDirections = GetDirections().Length;

        highlightedNeighbors = new PrevHighlightedTile[numDirections];
        for (int i = 0; i < numDirections; i++)
        {
            highlightedNeighbors[i] = new PrevHighlightedTile();
        }
    }
Ejemplo n.º 7
0
    /**
     *  Randomly spawns n doors
     *  Possible door tile positions include any position on the top/bot rows and left/right cols
     */
    public void SpawnNDoors(int n)
    {
        TilemapInfo tilemapInfo = TilemapInfo.Instance;
        Vector3Int  bottomLeft  = tilemapInfo.GetBottomLeftCornerTilePosition();
        Vector3Int  topRight    = tilemapInfo.GetTopRightCornerTilePosition();

        for (int i = 0; i < n; i++)
        {
            int randRow = UnityEngine.Random.Range(bottomLeft.y + 1, topRight.y - 1);
            int randCol = UnityEngine.Random.Range(bottomLeft.x + 1, topRight.x - 1);
            int row     = randRow;
            int col     = randCol;
            switch (i % 4)
            {
            case 0:     //top
                row = topRight.y;
                break;

            case 1:     //bot
                row = bottomLeft.y;
                break;

            case 2:     //left
                col = bottomLeft.x;
                break;

            case 3:     //right
                col = topRight.x;
                break;
            }

            Vector3Int doorTilePosition  = new Vector3Int(col, row, 0);
            Vector3    doorWorldPosition = tilemapInfo.GetWorldCoordinatesOfTilePosition(doorTilePosition);
            SpawnSprite(doorWorldPosition, Quaternion.identity);
        }
    }
Ejemplo n.º 8
0
    // Use this for initialization
    void Start()
    {
        ti = tilemap.GetComponent <TilemapInfo>();

        if (currentDir == null)
        {
            if (downDir.activeSelf)
            {
                currentDir = downDir;
            }
            else if (upDir.activeSelf)
            {
                currentDir = upDir;
            }
            else if (rightDir.activeSelf)
            {
                currentDir = rightDir;
            }
            else if (leftDir.activeSelf)
            {
                currentDir = leftDir;
            }
        }
    }
Ejemplo n.º 9
0
 protected virtual void Init()
 {
     tilemapInfo    = TilemapInfo.Instance;
     spriteMovement = this.GetComponent <SpriteMovement>();
 }
Ejemplo n.º 10
0
 void Awake()
 {
     Instance = this;
 }
Ejemplo n.º 11
0
 // Start is called before the first frame update
 void Start()
 {
     tilemapInfo          = TilemapInfo.Instance;
     OnNewSpriteSelected += OnNewSpriteSelectedHandler;
     OnSpriteDeselected  += OnSpriteDeselectedHandler;
 }
Ejemplo n.º 12
0
 void Start()
 {
     ti = tilemap.GetComponent <TilemapInfo>();
 }