Exemplo n.º 1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.CompareTag("Terrain"))
     {
         TilePos tilePos = PathfindingMap.WorldToTilePos(other.transform.position);
         int     tileId  = map.GetTile(tilePos.x, tilePos.y).blockTypeId;
         if (tileId == 3)   // collectible
         {
             Destroy(other.gameObject);
             collectibleSpawner.SpawnCollectible();
             bar.PickupCollectible();
         }
         else if (tileId == 2)     // throttle
         {
             Throttle();
         }
         else if (tileId == 4 && cash > 0)     //paywall
         {
             map.RemoveObstacle(tilePos.x, tilePos.y);
             cash -= 1; //temp
             UpdateCashText();
             Destroy(other.gameObject);
         }
     }
 }
Exemplo n.º 2
0
    public void PlaceBlock(int id)
    {
        TilePos tilePos = PathfindingMap.WorldToTilePos(spawns[id][0].pos);

        spawns[id].RemoveAt(0);

        map.AddObstacle(tilePos.x, tilePos.y, id);
    }
Exemplo n.º 3
0
 bool TileValid(Vector2Int tile)
 {
     if (PathfindingMap.CanWalkOnTile(new TilePos(tile.x, tile.y)) && (map.GetTile(tile.x, tile.y).blockTypeId != 4 || cash > 0))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 4
0
    void Awake()
    {
        //load resources
        //mapTexture = Resources.Load (mapName) as Texture2D;
        //backgroundMat = Resources.Load (backgroundMatName) as Material;

        path    = FindObjectOfType <PathfindingMap>();
        blocker = FindObjectOfType <SpawnManager>();
        player  = FindObjectOfType <PlayerController>();
        blocker.Init(this);

        bitmaskSprites = LoadBitmaskSprites("Border");

        LoadColorDictionary();
    }
Exemplo n.º 5
0
 private void Awake()
 {
     Instance = this;
 }