public static bool Marshmallow_RemoveMallow(
     Marshmallow __instance)
 {
     __instance._smokeParticles.Stop();
     __instance._fireRenderer.enabled   = false;
     __instance._mallowRenderer.enabled = false;
     __instance._mallowState            = Marshmallow.MallowState.Gone;
     __instance.enabled = false;
     new MarshmallowEventMessage(MarshmallowMessageType.Remove).Send();
     return(false);
 }
        public static bool Marshmallow_Shrivel(
            Marshmallow __instance
            )
        {
            if (__instance._mallowState == Marshmallow.MallowState.Burning)
            {
                __instance._initShrivelTime = Time.time;
                __instance._mallowState     = Marshmallow.MallowState.Shriveling;
                new MarshmallowEventMessage(MarshmallowMessageType.Shrivel).Send();
            }

            return(false);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Creator[] creators = new Creator[3];
            creators[0] = new CandyCreator();
            creators[1] = new CookieCreator();
            creators[2] = new MarshmallowCreator();

            IGift gift = new Gift();

            foreach (Creator i in creators)
            {
                if (i is CandyCreator)
                {
                    gift.Add(i.FactoryMethod("Mars", 80, 105, 1, TypeCandy.ChocolateCandy));
                    gift.Add(i.FactoryMethod("ChupaChups", 25, 75, 2, TypeCandy.Lollipop));
                }

                if (i is CookieCreator)
                {
                    gift.Add(i.FactoryMethod("Chico-pia", 100, 115, 4, TypeCoockie.biscuit));
                }

                if (i is MarshmallowCreator)
                {
                    gift.Add(i.FactoryMethod("Marshmallow", 230, 76.6f, 1, TasteMarshmallow.Orange));
                }
            }

            gift.Sort();
            gift.ShowItems();

            Console.WriteLine();
            Console.WriteLine("вкусность конфетки");

            Marshmallow marshmallowsweet = new Marshmallow("Marshmallow", 230, 76.6f, 1, TasteMarshmallow.Orange);

            marshmallowsweet.TypeSweet();

            Console.WriteLine();
            Console.WriteLine("сортировка по сахару");
            foreach (var items in gift.FindCandyBySugar(70, 110))
            {
                Console.WriteLine("{0}, Сахар: {1}", items.Name, items.Sugar);
            }



            Console.WriteLine();
            Console.WriteLine("Вес подарка: {0}", gift.GiftWeight());
            Console.ReadKey();
        }
Beispiel #4
0
 public static bool Marshmallow_RemoveMallow(
     ParticleSystem ____smokeParticles,
     MeshRenderer ____fireRenderer,
     MeshRenderer ____mallowRenderer,
     ref Marshmallow.MallowState ____mallowState,
     Marshmallow __instance)
 {
     ____smokeParticles.Stop();
     ____fireRenderer.enabled   = false;
     ____mallowRenderer.enabled = false;
     ____mallowState            = Marshmallow.MallowState.Gone;
     __instance.enabled         = false;
     QSBEventManager.FireEvent(EventNames.QSBMarshmallowEvent, MarshmallowEventType.Remove);
     return(false);
 }
        public static bool Marshmallow_Burn(
            Marshmallow __instance
            )
        {
            if (__instance._mallowState == Marshmallow.MallowState.Default)
            {
                __instance._fireRenderer.enabled = true;
                __instance._toastedFraction      = 1f;
                __instance._initBurnTime         = Time.time;
                __instance._mallowState          = Marshmallow.MallowState.Burning;
                __instance._audioController.PlayMarshmallowCatchFire();
                new MarshmallowEventMessage(MarshmallowMessageType.Burn).Send();
            }

            return(false);
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            Candy bestChoko = new Chocolate("Ritter Sport with coconut", 100, 3.44, 30, "Ritter Sport", 36, Enums.ChocolateKinds.Milk);
            Candy zefir     = new Marshmallow("Domashniy", 230, 2.77, 50, "AirSweet", Enums.MarshmallowKinds.Pink);

            Gift gift = new Gift("Christmas Gift", new List <Candy>());

            gift.Add(bestChoko);
            gift.Add(zefir);

            Console.WriteLine("Gift weight: " + gift.Weight + "g\r\n");

            var filtered = CandyFilters.WeightFilter(gift.Candies, 100, 300);

            filtered = CandyFilters.PriceFilter(filtered, 3, 4);

            Console.WriteLine("Filtered values:\r\n");

            foreach (var item in filtered)
            {
                Console.WriteLine(item + "\r\n");
            }

            gift.Candies.Sort(new PriceComparer <Candy>());

            Console.WriteLine("Sorted values:\r\n");

            foreach (var item in gift.Candies)
            {
                Console.WriteLine(item + "\r\n");
            }

            DataManager manage = new DataManager();

            manage.SaveJson(ref gift, "newgift.json");

            Console.Read();
        }
Beispiel #7
0
        public static bool RoastingStickController_UpdateMarshmallowInput(
            float ____extendFraction,
            Marshmallow ____marshmallow,
            GameObject ____mallowBodyPrefab,
            Transform ____stickTransform,
            Campfire ____campfire,
            ref string ____promptText,
            ScreenPrompt ____mallowPrompt,
            ref bool ____showMallowPrompt,
            ref bool ____showRemovePrompt)
        {
            var changePromptText = false;
            var showRemovePrompt = false;
            var text             = string.Empty;

            if (____extendFraction == 0f)
            {
                if (____marshmallow.IsEdible())
                {
                    text             = UITextLibrary.GetString(UITextType.RoastingEatPrompt);
                    changePromptText = true;
                    if (____marshmallow.IsBurned())
                    {
                        showRemovePrompt = true;
                        if (OWInput.IsNewlyPressed(InputLibrary.cancel, true, InputMode.Roasting))
                        {
                            ____marshmallow.Remove();
                            Locator.GetPlayerAudioController().PlayMarshmallowToss();
                            var spawnedMarshmallow = UnityEngine.Object.Instantiate <GameObject>(____mallowBodyPrefab, ____stickTransform.position, ____stickTransform.rotation);
                            var rigidbody          = spawnedMarshmallow.GetComponent <OWRigidbody>();
                            rigidbody.SetVelocity(____campfire.GetAttachedOWRigidbody(false).GetPointVelocity(____stickTransform.position) + (____stickTransform.forward * 3f));
                            rigidbody.SetAngularVelocity(____stickTransform.right * 10f);
                            var burntColor = ____marshmallow.GetBurntColor();
                            spawnedMarshmallow.GetComponentInChildren <MeshRenderer>().material.color = burntColor;
                            QSBEventManager.FireEvent(EventNames.QSBMarshmallowEvent, MarshmallowEventType.Toss);
                        }
                    }
                    if (OWInput.IsNewlyPressed(InputLibrary.interact, InputMode.Roasting) && ____marshmallow.IsEdible())
                    {
                        ____marshmallow.Eat();
                    }
                }
                else if (____marshmallow.GetState() == Marshmallow.MallowState.Burning)
                {
                    text             = UITextLibrary.GetString(UITextType.RoastingExtinguishPrompt);
                    changePromptText = true;
                    if (OWInput.IsNewlyPressed(InputLibrary.interact, InputMode.Roasting))
                    {
                        ____marshmallow.Extinguish();
                        QSBEventManager.FireEvent(EventNames.QSBMarshmallowEvent, MarshmallowEventType.Extinguish);
                    }
                }
                else if (____marshmallow.GetState() == Marshmallow.MallowState.Gone)
                {
                    text             = UITextLibrary.GetString(UITextType.RoastingReplacePrompt);
                    changePromptText = true;
                    if (OWInput.IsNewlyPressed(InputLibrary.interact, InputMode.Roasting))
                    {
                        ____marshmallow.SpawnMallow(true);
                    }
                }

                if (changePromptText && ____promptText != text)
                {
                    ____promptText = text;
                    ____mallowPrompt.SetText(____promptText);
                }

                if (OWInput.IsNewlyPressed(InputLibrary.cancel, InputMode.Roasting))
                {
                    ____campfire.StopRoasting();
                    return(false);
                }
            }

            ____showMallowPrompt = changePromptText;
            ____showRemovePrompt = showRemovePrompt;

            return(false);
        }