public void addGarbage(int val) { doWithRNG(ref garbagePositionRandomState, () => { List <Vector2i> spaces = getOpenGarbageSpaces(); if (spaces.Count == 0) { return; // No room for more garbage } Vector2i pos = spaces[Random.Range(0, spaces.Count)]; GarbageTile t = Instantiate(garbagePrefab.gameObject).GetComponent <GarbageTile>(); t.g = this; t.val = val; t.pos = pos; }); }
public void setGarbageAt(Vector2i position, GarbageTile t) { garbage[position.x, position.y] = t; }
public void setGarbageAt(int x, int y, GarbageTile t) { garbage[x, y] = t; }
void EnterTile() { OwnCharacter.EndRun(); if (FriendFarmManager.Instance != null) { return; } Point currentPoint = _currentLandTile.MapPoint; MapData.Instance.CurrentFarmerPoint = currentPoint; _currentLandTile.Highlight = true; _currentProductTile = ObjectTileManager.Instance.GetProductTileAtPoint(currentPoint); float grownSpeed = 0.0f; switch (_currentLandTile.Type) { case LandTile.BadlandType: grownSpeed = LandTile.BadlandGrownSpeedScale; break; case LandTile.GrassType: grownSpeed = LandTile.GrassGrownSpeedScale; break; case LandTile.CultivateType: grownSpeed = LandTile.CultivateGrownSpeedScale; break; default: Debug.LogWarning("Unknown Land Type!"); break; } FarmUIManager.Instance.UpdateLandTileChangeInteract(_currentLandTile.Type); if (ObjectTileManager.Instance.HasObjectTileAtPoint(currentPoint)) { if (ObjectTileManager.Instance.GetObjectTileTypeAtPoint(currentPoint) == ObjectTile.ETileType.Garbage) { _currentGarbageTile = ObjectTileManager.Instance.GetGarbageTileAtPoint(currentPoint); FarmUIManager.Instance.GarbageTileFuncButtonInteract(_currentGarbageTile.GetGarbageData()); } else { FarmUIManager.Instance.ObjectTileFuncButtonInteract(false); } } else { FarmUIManager.Instance.UpdatePlantProductEffectText(grownSpeed); FarmUIManager.Instance.ObjectTileFuncButtonInteract(true); } if (_currentProductTile != null) { // 수확 기능 if (_currentProductTile.CanHarvest) { FarmUIManager.Instance.HarvestButtonActive = true; } else { StartCoroutine(CheckCanHarvestEverySeconds()); } // 상단 FarmUIManager.Instance.ProductInfoGroupActive = true; FarmUIManager.Instance.SetProductInfoData(_currentProductTile.ProductData, grownSpeed); } }