Пример #1
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);
        }