Пример #1
0
 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;
     });
 }
Пример #2
0
 public void setGarbageAt(Vector2i position, GarbageTile t)
 {
     garbage[position.x, position.y] = t;
 }
Пример #3
0
 public void setGarbageAt(int x, int y, GarbageTile t)
 {
     garbage[x, y] = t;
 }
Пример #4
0
    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);
        }
    }