Пример #1
0
    private void Reset()
    {
        selectedRightChoice = null;
        selectedLeftChoice  = null;

        goodCollider.SetLightActiveTo(false);
        badCollider.SetLightActiveTo(false);

        badIsCollided  = false;
        goodIsCollided = false;
    }
Пример #2
0
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("Loading FallingObjectSpawner");

        FallingObjectSpawner           = gameObject.AddComponent <FallingBoxesSpawner>();
        FallingObjectSpawner.infoText  = infoText;
        FallingObjectSpawner.badLabel  = badLabel;
        FallingObjectSpawner.goodLabel = goodLabel;

        if (goodCollider == null)
        {
            Debug.LogError("FATAL: Good detector is null.");
        }
        else
        {
            goodCollider.onCollisionEnter = (e) =>
            {
                selectedLeftChoice = e;
                goodIsCollided     = true;
                UpdateCollisions();
            };
            goodCollider.onCollisionExit = () =>
            {
                selectedLeftChoice = null;
                goodIsCollided     = false;
                UpdateCollisions();
            };
        }

        if (badCollider == null)
        {
            Debug.LogError("FATAL: Bad detector is null.");
        }
        else
        {
            badCollider.onCollisionEnter = (e) =>
            {
                selectedRightChoice = e;
                badIsCollided       = true;
                UpdateCollisions();
            };
            badCollider.onCollisionExit = () =>
            {
                selectedRightChoice = null;
                badIsCollided       = false;
                UpdateCollisions();
            };
        }
    }
Пример #3
0
        public void SetUp() => Schedule(() =>
        {
            globalInputContainer.Child = choiceContainer = new ChoiceContainer
            {
                RelativeSizeAxes = Axes.Both,
                Anchor           = Anchor.Centre,
                Origin           = Anchor.Centre,
                Choices          = new[]
                {
                    new TestChoice(1),
                    new TestChoice(2),
                    new TestChoice(3)
                }
            };

            InputManager.MoveMouseTo(Vector2.Zero);
        });
Пример #4
0
    // When a cube enters the pillar
    void OnCollisionEnter(Collision hit)
    {
        if (onCollisionEnter != null)
        {
            ChoiceContainer c = hit.gameObject.GetComponent <ChoiceContainer>();

            if (c != null)
            {
                onCollisionEnter.Invoke(c);
            }
            else
            {
                Debug.LogError("FATAL ERROR : No choice container in collision.");
            }
        }
        else
        {
            Debug.Log("FATAL: OnCollisionExit is null.");
        }

        SetLightActiveTo(true);
    }
Пример #5
0
        public VirtualTreeLabelEditData BeginLabelEdit(int row, int column, VirtualTreeLabelEditActivationStyles activationStyle)
        {
            if (column != 1)
            {
                return(VirtualTreeLabelEditData.Invalid);
            }
            if (m_ReadOnly)
            {
                return(VirtualTreeLabelEditData.Invalid);
            }
            MemberInfo memberInfo             = m_Parameters[row];
            VirtualTreeLabelEditData @default = VirtualTreeLabelEditData.Default;

            if (memberInfo.Member.IsClass)
            {
                ChoiceContainer choiceContainer = new ChoiceContainer(this, row, column);
                ChoiceConverter.StaticChoices = new[] { NULL_VALUE_TEXT, memberInfo.Member.Type.FullName };
                PropertyDescriptor propertyDescriptor2 = TypeDescriptor.GetProperties(choiceContainer)["Choice"];
                @default.CustomInPlaceEdit = TypeEditorHost.Create(propertyDescriptor2, choiceContainer);
            }

            return(@default);
        }
Пример #6
0
        private DialogueElement CreateDialogueGUI(VisualElement root, ConversationRow conversation,
                                                  DialogueRow dialogue, IList <ContentElement> contents, string language)
        {
            var dialogueElem = new DialogueElement();

            var idElem = new IdElement {
                value = dialogue.Id
            };

            dialogueElem.Header.Add(idElem);

            var defaultChoiceData = dialogue.GetChoice(0);

            if (defaultChoiceData != null)
            {
                CreateDefaultChoiceGUI(dialogueElem, conversation, defaultChoiceData, contents, language);
            }

            if (dialogue.Choices.Count > 1)
            {
                var choiceContainer = new ChoiceContainer();
                choiceContainer.Add(new Label("Choices"));

                var first = true;

                foreach (var kv in dialogue.Choices)
                {
                    if (kv.Value.Id == 0)
                    {
                        continue;
                    }

                    var choiceElem = CreateChoiceGUI(choiceContainer, conversation, kv.Value, contents, language);

                    if (first)
                    {
                        first = false;
                        choiceElem.style.marginTop = 0;
                    }
                }

                dialogueElem.Add(choiceContainer);
            }

            if (!dialogue.IsEnd())
            {
                var sb        = new StringBuilder();
                var delayElem = new DelayElement("Delay")
                {
                    value = dialogue.Delay.ToString()
                };
                dialogueElem.Add(delayElem);

                var speakerElem = new SpeakerElement("Speaker")
                {
                    value = dialogue.Speaker
                };
                dialogueElem.Add(speakerElem);

                if (HasActors(dialogue))
                {
                    CreateCharacterTableGUI(dialogueElem, out var columnContainerElem);

                    CreateCharacterList <ActorColumnElement>(columnContainerElem, "Actor",
                                                             dialogue.Actor1, dialogue.Actor2, dialogue.Actor3, dialogue.Actor4);

                    CreateCharacterList <ActionColumnElement>(columnContainerElem, "Actions",
                                                              dialogue.Actions1.BuildString(sb), dialogue.Actions2.BuildString(sb),
                                                              dialogue.Actions3.BuildString(sb), dialogue.Actions4.BuildString(sb));
                }

                var highlightElem = new HighlightElement("Highlight")
                {
                    value = dialogue.Highlight.BuildString(sb)
                };
                dialogueElem.Add(highlightElem);
            }

            if (dialogue.CommandsOnStart.Count > 0 ||
                dialogue.CommandsOnEnd.Count > 0)
            {
                CreateCommandTableGUI(dialogueElem, dialogue.CommandsOnStart, dialogue.CommandsOnEnd);
            }

            root.Add(dialogueElem);
            return(dialogueElem);
        }
        public VirtualTreeLabelEditData BeginLabelEdit(int row, int column, VirtualTreeLabelEditActivationStyles activationStyle)
        {
            if (column != 1)
            {
                return VirtualTreeLabelEditData.Invalid;
            }
            if (m_ReadOnly)
            {
                return VirtualTreeLabelEditData.Invalid;
            }
            MemberInfo memberInfo = m_Parameters[row];
            VirtualTreeLabelEditData @default = VirtualTreeLabelEditData.Default;
            if (memberInfo.Member.IsClass)
            {
                ChoiceContainer choiceContainer = new ChoiceContainer(this, row, column);
                ChoiceConverter.StaticChoices = new[] { NULL_VALUE_TEXT, memberInfo.Member.Type.FullName };
                PropertyDescriptor propertyDescriptor2 = TypeDescriptor.GetProperties(choiceContainer)["Choice"];
                @default.CustomInPlaceEdit = TypeEditorHost.Create(propertyDescriptor2, choiceContainer);
            }

            return @default;
        }
Пример #8
0
    IEnumerator ShowChoice(ChoiceContainer cContainer)
    {
        float startTime = Time.time;

        gameManager.GameState           = Enums.GameState.cutscene;
        cutsceneManager.dialogueOngoing = true;
        player.GetComponent <PlayerController>().enabled = false;

        yield return(null);

        string name = GetSpeakerName(cContainer.speaker);

        if (name != null)
        {
            switch (cContainer.speaker)
            {
            case Speakers.Zork:
                nameText.color = cZorkName;
                break;

            case Speakers.Ramu:
                nameText.color = cRamuName;
                break;

            case Speakers.Villager:
                nameText.color = cVillagerName;
                break;

            case Speakers.Player:
                nameText.color = cPlayerName;
                break;
            }

            nameText.text = name;
            nameBox.SetActive(true);
        }

        if (playerConfig.gameMode != GameMode.agencyNegative)
        {
            choice1Text.text = cContainer.option1;
            choice2Text.text = cContainer.option2;
        }

        else
        {
            choice1Text.text = cContainer.option2;
            choice2Text.text = cContainer.option1;
        }

        choice1.gameObject.SetActive(true);
        choice2.gameObject.SetActive(true);

        cutsceneText.text = cContainer.question;
        cutsceneBox.SetActive(true);

        yield return(new WaitUntil(() => buttonOneDown || buttonTwoDown));

        player.GetComponent <PlayerController>().enabled = true;
        gameManager.GameState           = Enums.GameState.playing;
        cutsceneManager.dialogueOngoing = false;
        cutsceneBox.SetActive(false);
        nameBox.SetActive(false);

        if (buttonOneDown)
        {
            choiceManager.RecordChoice(cContainer.choiceNumber, "1", (Time.time - startTime).ToString());
            buttonOneDown = false;
        }
        else
        {
            choiceManager.RecordChoice(cContainer.choiceNumber, "2", (Time.time - startTime).ToString());
            buttonTwoDown = false;
        }
    }