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

        tilemapInfo = TilemapInfo.Instance;
    }
Beispiel #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;
 }
Beispiel #4
0
    void Start()
    {
        tilemapInfo = TilemapInfo.Instance;
        tiles       = Tiles.Instance;
        tilemap     = tilemapInfo.GetTilemap();

        AddDependencies();
    }
    /**
     *  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;
    }
Beispiel #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();
        }
    }
    /**
     *  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);
        }
    }
Beispiel #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;
            }
        }
    }
Beispiel #9
0
 protected virtual void Init()
 {
     tilemapInfo    = TilemapInfo.Instance;
     spriteMovement = this.GetComponent <SpriteMovement>();
 }
Beispiel #10
0
 void Awake()
 {
     Instance = this;
 }
Beispiel #11
0
 // Start is called before the first frame update
 void Start()
 {
     tilemapInfo          = TilemapInfo.Instance;
     OnNewSpriteSelected += OnNewSpriteSelectedHandler;
     OnSpriteDeselected  += OnSpriteDeselectedHandler;
 }
 void Start()
 {
     ti = tilemap.GetComponent <TilemapInfo>();
 }