Ejemplo n.º 1
0
 public override void TurnOn(CustomDialogueUI ui)
 {
     // The first thing we do is call parent class's turn on
     // will set dialogueUI field
     base.TurnOn(ui);
     ui.onOptionsStart += SetupOptions;
 }
Ejemplo n.º 2
0
    public static void HandleAttribute(Yarn.Markup.MarkupAttribute attribute, CustomDialogueUI ui)
    {
        switch (attribute.Name)
        {
        case Character:
            SetDialogueGivenLine(attribute, ui);
            break;

        case Wave:
            float speed = attribute.Properties.ContainsKey("s") ? attribute.Properties["s"].FloatValue : 0.5f;
            ui.currentDialogue.tweenText.Wave(
                attribute.Position,
                attribute.Position + attribute.Length,
                speed);
            break;

        case Shake:
            float strength = attribute.Properties.ContainsKey("s") ? attribute.Properties["s"].IntegerValue : 4;
            ui.currentDialogue.tweenText.Shake(
                attribute.Position,
                attribute.Position + attribute.Length,
                strength);
            break;

        case Screenshake:
            float amplitude = attribute.Properties.ContainsKey("a") ? attribute.Properties["a"].FloatValue : 1;
            MainSingleton.Instance.ImpulseSource.m_ImpulseDefinition.m_AmplitudeGain = amplitude;
            MainSingleton.Instance.ImpulseSource.GenerateImpulse();
            break;
        }
    }
Ejemplo n.º 3
0
 public virtual void TurnOff()
 {
     MainSingleton.Instance.input.onActionTriggered -= TriggerNextLine;
     if (this.dialogueUI)
     {
         dialogueUI.onLineStart             = OnLineStart;
         dialogueUI.onTextFinishDisplaying -= tweenText.KillShow;
         dialogueUI.onLineParse            -= tweenText.Clear;
         this.dialogueUI = null;
     }
     Hide();
 }
Ejemplo n.º 4
0
    public virtual void TurnOn(CustomDialogueUI ui)
    {
        // Ensure gameobject is on, and we set dialogueUI field
        gameObject.SetActive(true);

        if (IsOn())
        {
            return;
        }

        MainSingleton.Instance.input.onActionTriggered += TriggerNextLine;
        ui.onLineStart             = OnLineStart;
        ui.onTextFinishDisplaying += tweenText.KillShow;
        ui.onLineParse            += tweenText.Clear;
        this.dialogueUI            = ui;
    }
Ejemplo n.º 5
0
    /// <summary>
    /// Set current DialogueGroup based on line attributes: character name
    /// </summary>
    /// <param name="dialogueLine"></param>
    private static void SetDialogueGivenLine(Yarn.Markup.MarkupAttribute attribute, CustomDialogueUI ui)
    {
        string       name = attribute.Properties["name"].StringValue;
        DialogueType type;

        // Edit below to add more types
        switch (name)
        {
        case "Player":
            type = DialogueType.Player;
            break;

        case "Think":
            type = DialogueType.Think;
            break;

        default:
            type = DialogueType.NPC;
            break;
        }
        ui.SetCurrentDialogue(type, name);
    }