Added basic notification system

-Works with minimal calls to SendNotification(), infinite loop possible
on multiple calls
-Add to MoreExp()
--Add case for multiple notifications of same type combining value
--If notification timer > maxTime
---expRate = expNotifyValue / secondsPassed
---Display Exp/s instead of continuously growing value
This commit is contained in:
2017-09-04 19:53:18 -04:00
parent cc86eabeef
commit 33664d2735
5 changed files with 204 additions and 2 deletions

View File

@@ -0,0 +1,38 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PopupNotification : MonoBehaviour {
public bool active = false;
public Vector3 origin;
public float timer = 0.0f;
public string localNotify;
// Use this for initialization
void OnEnable () {
active = true;
origin = this.transform.localPosition;
localNotify = GameObject.Find("EventSystem").GetComponent<GameManager>().GetNotify();
}
// Update is called once per frame
void FixedUpdate () {
timer += 0.02f;
this.gameObject.transform.Translate(new Vector3(0, 10f * Time.deltaTime, 0));
this.gameObject.GetComponentInChildren<Text>().text = localNotify;
if(timer >= 3)
{
this.gameObject.SetActive(false);
active = false;
timer = 0.0f;
this.gameObject.transform.localPosition = origin;
}
}
}