void FixedUpdate() { Vector2 tileInd = terrain.tileFromPos(transform.localPosition); try{ curTile = engine.mapgen.tiles[(int)tileInd.x,(int)tileInd.y]; }catch{ curTile = null; } if (curTile != null){ if (curTile.isOnFire()){ health -= curTile.heatIndex/10.0f; } } //check if the character has died if (health < 0) { killSquirrel(); } }