public void OnTouchStart(Vector2 p_point, int p_touchID)
        {
            if (OnTouchMove(p_point, p_touchID))
            {
                return;
            }
            mg_pt_ToppingHolderObject mg_pt_ToppingHolderObject2 = FindTopping(p_point);

            if (!(mg_pt_ToppingHolderObject2 != null))
            {
                return;
            }
            if (mg_pt_ToppingHolderObject2.IsSauce)
            {
                if (!m_holdingSauce)
                {
                    mg_pt_Topping mg_pt_Topping2 = GrabTopping(mg_pt_ToppingHolderObject2.ToppingType, mg_pt_ToppingHolderObject2.HeldTagSFX, p_point, p_touchID);
                    if (mg_pt_Topping2 != null)
                    {
                        m_holdingSauce = true;
                        mg_pt_ToppingHolderObject2.OnGrabbed();
                    }
                }
            }
            else
            {
                mg_pt_Topping mg_pt_Topping2 = GrabTopping(mg_pt_ToppingHolderObject2.ToppingType, mg_pt_ToppingHolderObject2.HeldTagSFX, p_point, p_touchID);
                if (mg_pt_Topping2 != null)
                {
                    mg_pt_ToppingHolderObject2.OnGrabbed();
                }
            }
        }
        public void OnTouchEnd(Vector2 p_point, int p_touchID)
        {
            mg_pt_Topping mg_pt_Topping2 = m_toppings.Find((mg_pt_Topping searchTopping) => searchTopping.TouchID == p_touchID && searchTopping.State == mg_pt_EToppingState.GRABBED);

            if (mg_pt_Topping2 != null)
            {
                mg_pt_Topping2.UpdatePosition(p_point);
                DropTopping(mg_pt_Topping2);
            }
        }
        private void UpdateTopping(mg_pt_Topping p_topping)
        {
            bool mysteryPizza = m_gameLogic.Order.MysteryPizza;

            m_gameLogic.Order.AddTopping(p_topping);
            if (mysteryPizza)
            {
                AddCoin(p_topping);
            }
        }
        private mg_pt_Topping GrabTopping(mg_pt_EToppingType p_toppingType, string p_heldTagSFX, Vector2 p_position, int p_touchID)
        {
            mg_pt_Topping mg_pt_Topping2 = m_toppings.Find((mg_pt_Topping topping) => topping.State == mg_pt_EToppingState.IDLE);

            if (mg_pt_Topping2 != null)
            {
                mg_pt_Topping2.SetTopping(p_toppingType, base.gameObject, p_heldTagSFX);
                mg_pt_Topping2.OnGrabbed(p_position, p_touchID);
            }
            return(mg_pt_Topping2);
        }
        public bool OnToppingDropped(mg_pt_Topping p_topping)
        {
            bool result = false;

            if (State == mg_pt_EPizzaState.ACTIVE && !p_topping.IsSauce && m_pizzaObject.ContainsPoint(p_topping.Position))
            {
                AddTopping(p_topping);
                result = true;
            }
            return(result);
        }
 private void DropTopping(mg_pt_Topping p_topping)
 {
     p_topping.Drop();
     if (p_topping.IsSauce)
     {
         m_holdingSauce = false;
     }
     if (!m_gameLogic.OnToppingDropped(p_topping))
     {
         m_gameLogic.Minigame.PlaySFX("mg_pt_sfx_topping_release_0" + Random.Range(1, 4));
     }
 }
        public bool OnTouchMove(Vector2 p_point, int p_touchID)
        {
            bool          result         = false;
            mg_pt_Topping mg_pt_Topping2 = m_toppings.Find((mg_pt_Topping searchTopping) => searchTopping.TouchID == p_touchID && searchTopping.State == mg_pt_EToppingState.GRABBED);

            if (mg_pt_Topping2 != null)
            {
                mg_pt_Topping2.UpdatePosition(p_point);
                m_gameLogic.OnToppingMoved(mg_pt_Topping2);
                result = true;
            }
            return(result);
        }
 private void AddTopping(mg_pt_Topping p_topping)
 {
     UpdateTopping(p_topping);
     if (p_topping.IsCheese)
     {
         m_pizzaObject.ShowCheese();
     }
     p_topping.Place(m_pizzaObject.gameObject);
     if (p_topping.State == mg_pt_EToppingState.PLACED)
     {
         m_toppings.Add(p_topping);
     }
 }
 public void OnToppingMoved(mg_pt_Topping p_topping)
 {
     if (State == mg_pt_EPizzaState.ACTIVE && p_topping.IsSauce && m_pizzaObject.ContainsPoint(p_topping.SaucePosition))
     {
         if (m_sauceBeingAdded != p_topping.Type)
         {
             m_pizzaObject.ClearSauce(m_gameLogic.Minigame.Resources.GetSauceColor(p_topping.Type));
             m_gameLogic.Order.ResetSauce();
             m_sauceBeingAdded = p_topping.Type;
         }
         m_pizzaObject.AddSauceAt(this, p_topping);
     }
 }
Exemple #10
0
        public void AddTopping(mg_pt_Topping p_topping)
        {
            mg_pt_OrderComponent mg_pt_OrderComponent2 = m_allToppings.Find((mg_pt_OrderComponent topping) => topping.Topping == p_topping.Type);

            if (mg_pt_OrderComponent2 != null)
            {
                if (p_topping.IsSauce)
                {
                    mg_pt_OrderComponent2.CurrentCount = 1;
                    int coins = 0;
                    m_sauces.ForEach(delegate(mg_pt_OrderComponent sauce)
                    {
                        coins += sauce.CoinsEarnt;
                    });
                    if (coins == 0)
                    {
                        mg_pt_OrderComponent2.CoinsEarnt++;
                        CoinsToAward++;
                    }
                }
                else if (p_topping.IsCheese)
                {
                    mg_pt_OrderComponent2.CurrentCount = 1;
                    if (mg_pt_OrderComponent2.CoinsEarnt == 0)
                    {
                        mg_pt_OrderComponent2.CoinsEarnt++;
                        CoinsToAward++;
                    }
                }
                else
                {
                    mg_pt_OrderComponent2.CurrentCount++;
                    CoinsToAward++;
                }
                if (p_topping.IsSauce)
                {
                    if (mg_pt_OrderComponent2.RequiredCount > 0 || MysteryPizza)
                    {
                        m_gameLogic.Minigame.PlaySFX("mg_pt_sfx_topping_drop");
                    }
                }
                else
                {
                    m_gameLogic.Minigame.PlaySFX((mg_pt_OrderComponent2.RequiredCount > 0 || MysteryPizza) ? "mg_pt_sfx_topping_drop" : "mg_pt_sfx_topping_error");
                }
            }
            m_gameLogic.OnOrderChanged();
            CheckCompletion();
        }
Exemple #11
0
        private bool WillAddSauce(mg_pt_Topping p_sauce)
        {
            bool             result            = false;
            Vector2          p_localPoint      = base.transform.InverseTransformPoint(p_sauce.SaucePosition);
            mg_pt_PizzaPoint mg_pt_PizzaPoint2 = null;
            float            num    = Mathf.Pow(m_xRadius * base.transform.lossyScale.x, 2f);
            float            num2   = Mathf.Pow(m_yRadius * base.transform.lossyScale.y, 2f);
            float            num3   = 0f - m_xRadius + p_localPoint.x;
            float            num4   = 0f - m_yRadius + p_localPoint.y;
            float            num5   = num4;
            Vector2          vector = CalculatePizzaPointIndex(p_localPoint);

            vector.y = Mathf.Abs(vector.y);
            while (num3 <= m_xRadius + p_localPoint.x)
            {
                float num6 = num3 * base.transform.lossyScale.x;
                float num7 = Mathf.Pow(num6 - p_localPoint.x, 2f);
                for (; num4 <= p_localPoint.y; num4 += m_gameYSpacing)
                {
                    float num8  = num4 * base.transform.lossyScale.y;
                    float num9  = Mathf.Pow(num8 - p_localPoint.y, 2f);
                    float num10 = num7 / num + num9 / num2;
                    if (!(num10 <= 1f))
                    {
                        continue;
                    }
                    Vector2 vector2 = CalculatePizzaPointIndex(new Vector2(num6, num8));
                    int     num11   = (int)(vector.y - vector2.y);
                    for (int i = (int)vector2.y; (float)i <= vector.y + (float)num11; i++)
                    {
                        mg_pt_PizzaPoint2 = GetPizzaPoint(new Vector2(vector2.x, i));
                        if (mg_pt_PizzaPoint2 != null && !mg_pt_PizzaPoint2.Transparent && !mg_pt_PizzaPoint2.SauceAdded)
                        {
                            result = true;
                            mg_pt_PizzaPoint2.SauceAdded = true;
                            m_saucePointsAdded++;
                        }
                    }
                    break;
                }
                num3 += m_gameXSpacing;
                num4  = num5;
            }
            return(result);
        }
Exemple #12
0
 private void AddCoin(mg_pt_Topping p_topping)
 {
     while (m_gameLogic.Order.CoinsToAward > 0)
     {
         mg_pt_CoinObject mg_pt_CoinObject2 = m_coins.Find((mg_pt_CoinObject coin) => coin.State == mg_pt_ECoinState.INACTIVE);
         if (mg_pt_CoinObject2 == null)
         {
             GameObject instancedResource = m_gameLogic.Minigame.Resources.GetInstancedResource(mg_pt_EResourceList.GAME_COIN);
             MinigameSpriteHelper.AssignParent(instancedResource, m_gameScreen.GameTransform.gameObject);
             mg_pt_CoinObject2 = instancedResource.GetComponent <mg_pt_CoinObject>();
             m_coins.Add(mg_pt_CoinObject2);
         }
         mg_pt_CoinObject2.Spawn(p_topping.IsSauce ? p_topping.SaucePosition : p_topping.Position);
         m_gameLogic.Order.CoinsToAward--;
         m_totalCoinsSpawned++;
     }
     m_gameLogic.Order.CoinsToAward = 0;
 }
Exemple #13
0
 public void AddSauceAt(mg_pt_Pizza p_pizza, mg_pt_Topping p_sauce)
 {
     if (!m_sauceCompleted && WillAddSauce(p_sauce))
     {
         Vector2     vector    = CalculateSauceRendererPoint(p_sauce.SaucePosition);
         int         num       = m_meshFilter.mesh.vertices.Length;
         int         num2      = 41;
         float       num3      = 360f / (float)(num2 - 1);
         Vector3[]   array     = new Vector3[num2];
         int[]       array2    = new int[num2 * 3];
         ref Vector3 reference = ref array[0];
         reference = vector;
         for (int i = 1; i < num2; i++)
         {
             Vector3 vector2 = Quaternion.AngleAxis(num3 * (float)(i - 1), Vector3.back) * Vector3.up;
             vector2.x *= 0.2f;
             vector2.y *= 0.2f;
             vector2.x += vector.x;
             vector2.y += vector.y;
             array[i]   = vector2;
         }
         for (int i = 0; i + 2 < num2; i++)
         {
             int num4 = i * 3;
             array2[num4]     = num;
             array2[num4 + 1] = num + i + 1;
             array2[num4 + 2] = num + i + 2;
         }
         int num5 = array2.Length - 3;
         array2[num5]                = num;
         array2[num5 + 1]            = num + num2 - 1;
         array2[num5 + 2]            = num + 1;
         m_meshFilter.mesh.vertices  = m_meshFilter.mesh.vertices.Concat(array).ToArray();
         m_meshFilter.mesh.triangles = m_meshFilter.mesh.triangles.Concat(array2).ToArray();
         if ((float)m_totalPizzaPoints * 0.85f <= (float)m_saucePointsAdded)
         {
             CompleteSauce(p_pizza, p_sauce);
         }
         m_meshFilter.mesh.bounds = new Bounds(Vector3.zero, new Vector3(500f, 500f, 500f));
     }
Exemple #14
0
 public void SauceAdded(mg_pt_Topping p_sauce)
 {
     UpdateTopping(p_sauce);
 }
 public void OnToppingMoved(mg_pt_Topping p_topping)
 {
     m_pizza.OnToppingMoved(p_topping);
 }
 public bool OnToppingDropped(mg_pt_Topping p_topping)
 {
     return(m_pizza.OnToppingDropped(p_topping));
 }