From 19d32b28f4888407a5c06ed84a751a2c35691d2b Mon Sep 17 00:00:00 2001 From: marcinzelent Date: Sat, 27 Apr 2019 18:00:48 +0200 Subject: Added messaging --- nGJ2019/Assets/Scripts/Messenger.cs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 nGJ2019/Assets/Scripts/Messenger.cs (limited to 'nGJ2019/Assets/Scripts/Messenger.cs') diff --git a/nGJ2019/Assets/Scripts/Messenger.cs b/nGJ2019/Assets/Scripts/Messenger.cs new file mode 100644 index 0000000..ca2ffe1 --- /dev/null +++ b/nGJ2019/Assets/Scripts/Messenger.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +public class Messenger : MonoBehaviour +{ + public Text MainText; + public ObstacleSpawner Spawner; + private EventTimeline timeline; + + // Start is called before the first frame update + void Start() + { + timeline = Spawner.GetEventTimeline(); + + timeline.Add(1, "Test"); + + timeline.OnMessageEvent += MessageOnEvent; + } + + // Update is called once per frame + void Update() + { + + } + + void MessageOnEvent(EventTimeline.MessageEvent e) + { + MainText.text = e.message; + } +} -- cgit v1.2.3