Permalink
Browse files

Updated example output to provide info on message life, priority and …

…time raised.
  • Loading branch information...
GandhiGames committed Oct 25, 2016
1 parent 3c20d56 commit 5e16ec4c255f6a38e185cba4eaef82dfecc0374a
Showing with 16 additions and 5 deletions.
  1. +16 −5 Assets/Scripts/Demo/MessageQueueTest.cs
@@ -1,24 +1,35 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using GameFoundations;
public class MessageQueueTest : MonoBehaviour
{
private int count = 1;
private Dictionary<MessagePriority, string> priorityLookup = new Dictionary<MessagePriority, string>();
void Start()
{
priorityLookup.Add (MessagePriority.Low, "Low");
priorityLookup.Add (MessagePriority.Medium, "Medium");
priorityLookup.Add (MessagePriority.High, "High");
}
void Update ()
{
if (Input.GetMouseButtonDown (0)) {
MessagePriority priorty = MessagePriority.High;
MessagePriority priority = MessagePriority.High;
float random = Random.value;
if (random < 0.333f) {
priorty = MessagePriority.Low;
priority = MessagePriority.Low;
} else if (random < 0.666f) {
priorty = MessagePriority.Medium;
priority = MessagePriority.Medium;
}
Events.instance.Raise (new MessageEvent ("Test Message " + count++, Time.time + 3f, priorty));
float showTime = Random.Range (1f, 5f);
Events.instance.Raise (new MessageEvent (priorityLookup[priority] + " priority message shown at "
+ System.DateTime.Now + " for " + showTime + " seconds", Time.time + showTime, priority));
}
}
}

0 comments on commit 5e16ec4

Please sign in to comment.