예제 #1
0
 public void EmptyCookingPlace(bool penalty)
 {
     particlesBurst.Play();
     particles.Stop();
     int p = 0;
     foreach(Recipes.eIngredients ingr in inPot)
     {
         if (ingr != Recipes.eIngredients.empty)
         {
             p += Ingredient.INGREDIENT_PENALTY;
         }
     }
     if (penalty)
     {
         GameObject.Find("Game").GetComponent<PlaySounds>().playPuff();
         Game.GAME.AddScore(-p);
         PointLabel.SpawnAt(pointLabelPrefab, transform.parent, transform.position, -p);
     }
     else
     {
         GameObject.Find("Game").GetComponent<PlaySounds>().playComplete();
     }
     effect.transform.localScale = Vector3.zero;
     inPot = new Recipes.eIngredients[MAX_INGREDIENTS];
     for (int i = 0; i < MAX_INGREDIENTS; i++)
     {
         inPot[i] = Recipes.eIngredients.empty;
     }
     GetComponent<AudioSource>().Stop();
 }
예제 #2
0
 private bool CheckRecipes()
 {
     for (int recipeIdx = 0; recipeIdx < Game.GAME.GetFoodOrders().Length; recipeIdx++)
     {
         Recipes.Recipe recipe = Game.GAME.GetFoodOrders()[recipeIdx];
         if (FitsRecipe(recipe))
         {
             PointLabel.SpawnAt(pointLabelPrefab, transform.parent, transform.position, recipe.points);
             Game.GAME.AddScore(recipe.points);
             Game.GAME.NextRecipe(recipeIdx);
             EmptyCookingPlace(false);
             return true;
         }
     }
     return false;
 }
예제 #3
0
    public void Update()
    {
        if (PauseMenu.PAUSED)
        {
            return;
        }

        if (tile == null)
        {
            if (died)
            {
                IngredientKillEffects.PlayDeathEffect((int)ingredientType - 1, transform.position, transform.parent);
                Game.GAME.AddScore(-INGREDIENT_PENALTY);
                PointLabel.SpawnAt(pointLabelPrefab, transform.parent, transform.position, -INGREDIENT_PENALTY);
                Debug.Log("-" + INGREDIENT_PENALTY + " points: Fell out of board or was crushed!");
            }
            Destroy(gameObject);
            return;
        }

        if (IsBlocked())
        {
            return;
        }

        IBoardMovePattern movePattern = tile.GetMovePattern();

        if (wait)
        {
            int           nextX    = boardX + (int)movePattern.NextTile(this).x;
            int           nextY    = boardY + (int)movePattern.NextTile(this).y;
            GameBoardTile nextTile = Game.BOARD.GetTile(nextX, nextY);
            if (tile is BaseTile && nextTile is BaseTile)
            {
                if (IsConveyerBeltAdjacent((BaseTile)tile, (BaseTile)nextTile))
                {
                    boardX             = nextX;
                    boardY             = nextY;
                    tile               = nextTile;
                    transform.position = tile.GetMovePattern().GetStart(this);
                    wait               = false;
                }
            }
            return;
        }

        transform.position += tile.GetMovePattern().Step(this, transform.position);
        transform.Rotate(tile.GetMovePattern().RotStep(this));
        if (movePattern.ReachedDestination(this, transform.position))
        {
            int nextX = boardX + (int)movePattern.NextTile(this).x;
            int nextY = boardY + (int)movePattern.NextTile(this).y;

            // This needs to go somewhere else! Yanderedev-Style Code. I know dammit. I dont have much time okay!!!
            if (nextX == 0 && nextY == -1)
            {
                died = false;
                CookingPlace pot = GameObject.Find("CookingPot1").GetComponent <CookingPlace>();
                pot.AddIngredient(ingredientType);
            }
            else if (nextX == 2 && nextY == -1)
            {
                died = false;
                CookingPlace pot = GameObject.Find("CookingPot2").GetComponent <CookingPlace>();
                pot.AddIngredient(ingredientType);
            }
            else if (nextX == -1 && nextY == 2)
            {
                died = false;
                CookingPlace pot = GameObject.Find("CookingPot3").GetComponent <CookingPlace>();
                pot.AddIngredient(ingredientType);
            }
            else if (nextX == 5 && nextY == 2)
            {
                died = false;
                CookingPlace pot = GameObject.Find("CookingPot4").GetComponent <CookingPlace>();
                pot.AddIngredient(ingredientType);
            }

            GameBoardTile nextTile = Game.BOARD.GetTile(nextX, nextY);
            if (nextTile == null)
            {
                tile = null;
            }
            else
            {
                wait = true;
            }
        }
    }