Esempio n. 1
0
    public Trigger(TmxObject obj, LevelSettings settings)
    {
        repeat = obj.properties.GetInt("Repeat", 0) != 0;

        string targetDialogue;

        if (obj.properties.GetTag("Dialogue", out targetDialogue))
        {
            var dia = settings.dialogueMap[targetDialogue];
            Run += () => {
                if (!LevelManager.instance.settings.HasDialogueFlag(dia))
                {
                    LevelManager.instance.settings.StoreDialogueFlag(dia);
                    DialogueManager.DialogueComplete = GameWorld.GoBackToLevel;
                    DialogueManager.ActivateDialogue(dia);
                }
            };
        }

        area = obj.position;
        Trigger.ActionType at = Trigger.ActionType.Any;
        try {
            at = (Trigger.ActionType)Enum.Parse(typeof(Trigger.ActionType), obj.type, true);
        } catch (ArgumentException ae) {
            Debug.LogError(ae.Message);
        }
        type = at;
    }
Esempio n. 2
0
    public void Execute(Trigger.ActionType type)
    {
        type |= Trigger.ActionType.Any;
        var none = (Trigger.ActionType) 0;

        foreach (var a in _actions)
        {
            if ((a.type & type) != none)
            {
                a.OnRun();
            }
        }

        _actions.RemoveAll(_ => (_.type & type) != none && _.repeat == false);
    }