private void AddIngredient(Ingredient ingredient) { var last = _sprites.Last.Value.transform; var localPosition = last.localPosition; last.localPosition = new Vector2(localPosition.x, localPosition.y + Speed); Cocktail.AddIngredient(ingredient.key); }
// TODO : Think about making it inside drag and drop and not collision private void OnCollisionEnter2D(Collision2D collision) { var go = collision.gameObject; var consumable = go.GetComponent <Consumable>(); if (consumable == null) { return; } go.transform.SetParent(transform); Destroy(go.GetComponent <Rigidbody2D>()); Cocktail.AddIngredient(consumable.ingredient.key); }
private void AddIngredient(IngredientKey ingredientKey) { if (IsFull()) { PlayFull(); return; } var currentPosition = LineRenderers.Last.Value.GetPosition(1); var stepPosition = Vector3.up * 0.1f; LineRenderers.Last.Value.SetPosition(1, currentPosition + stepPosition); Cocktail.AddIngredient(ingredientKey); }