Skip to content

Commit ec759c1

Browse files
committed
Adds timeline event tests
For some reason the EventManager trigger kept locking up Unity 🙄
1 parent 6570483 commit ec759c1

File tree

5 files changed

+67
-12
lines changed

5 files changed

+67
-12
lines changed

Assets/_Project/Scenes/tally-viz.unity

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,8 @@ Transform:
477477
m_PrefabAsset: {fileID: 0}
478478
m_GameObject: {fileID: 215753796}
479479
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
480-
m_LocalPosition: {x: 0, y: 0, z: -5}
481-
m_LocalScale: {x: 70.5, y: 41.7, z: 10}
480+
m_LocalPosition: {x: 0, y: 0.9, z: -5}
481+
m_LocalScale: {x: 87.54, y: 50, z: 10}
482482
m_Children: []
483483
m_Father: {fileID: 2123156135}
484484
m_RootOrder: 3
@@ -2995,6 +2995,10 @@ PrefabInstance:
29952995
propertyPath: m_Name
29962996
value: PlayerPrefab
29972997
objectReference: {fileID: 0}
2998+
- target: {fileID: 9008334923571228613, guid: ecec1fc7bdc6441a691ca908dfadc8b4, type: 3}
2999+
propertyPath: m_IsActive
3000+
value: 0
3001+
objectReference: {fileID: 0}
29983002
m_RemovedComponents: []
29993003
m_SourcePrefab: {fileID: 100100000, guid: ecec1fc7bdc6441a691ca908dfadc8b4, type: 3}
30003004
--- !u!1 &1339374947
@@ -3125,7 +3129,7 @@ Transform:
31253129
m_PrefabAsset: {fileID: 0}
31263130
m_GameObject: {fileID: 1343860835}
31273131
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
3128-
m_LocalPosition: {x: 0, y: 80, z: 0}
3132+
m_LocalPosition: {x: 0, y: 70, z: 0}
31293133
m_LocalScale: {x: 1, y: 1, z: 1}
31303134
m_Children: []
31313135
m_Father: {fileID: 2060185372}
@@ -3399,8 +3403,8 @@ MonoBehaviour:
33993403
m_fontMaterials: []
34003404
m_fontColor32:
34013405
serializedVersion: 2
3402-
rgba: 2835349503
3403-
m_fontColor: {r: 1, g: 1, b: 1, a: 0.65882355}
3406+
rgba: 1020971081
3407+
m_fontColor: {r: 0.28627452, g: 0.78431374, b: 0.85490197, a: 0.23529412}
34043408
m_enableVertexGradient: 0
34053409
m_colorMode: 3
34063410
m_fontColorGradient:
@@ -3898,7 +3902,7 @@ Camera:
38983902
far clip plane: 1000
38993903
field of view: 60
39003904
orthographic: 1
3901-
orthographic size: 20
3905+
orthographic size: 25
39023906
m_Depth: -1
39033907
m_CullingMask:
39043908
serializedVersion: 2
@@ -3984,7 +3988,7 @@ Transform:
39843988
m_PrefabAsset: {fileID: 0}
39853989
m_GameObject: {fileID: 2011923385}
39863990
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
3987-
m_LocalPosition: {x: 0, y: -80, z: 0}
3991+
m_LocalPosition: {x: 0, y: -70, z: 0}
39883992
m_LocalScale: {x: 1, y: 1, z: 1}
39893993
m_Children: []
39903994
m_Father: {fileID: 2060185372}

Assets/_Project/Scripts/Data/DataManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ public static IEnumerator GetRequest (string uri)
310310
// update count
311311
dataCount = feeds.Count;
312312

313-
// trigger event
313+
// trigger data updated event
314314
EventManager.TriggerEvent ("DataUpdated");
315315

316316

Assets/_Project/Scripts/Data/TimelineManager.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,22 @@ IEnumerator Play ()
9191
feed.username + ", " + feed.eventType +
9292

9393
"";
94+
feedText.text += log + "<br>";
9495

9596

96-
feedText.text += log + "<br>";
97+
98+
// TEMP
99+
100+
// pick random player and random event
101+
PlayerManager.Instance.PlayRandomEvent ();
102+
103+
// trigger data updated event
104+
//EventManager.TriggerEvent ("DataUpdated");
105+
97106

98107
UpdateScroll ();
99108

109+
100110
//Debug.Log(log);
101111

102112

Assets/_Project/Scripts/Effects/TallyAnimController.cs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ public class TallyAnimController : MonoBehaviour {
1010

1111
public Animator animator;
1212
public int currentAnimation;
13-
13+
public int counter;
14+
float r = 0;
1415

1516
void Start ()
1617
{
@@ -21,6 +22,17 @@ void Start ()
2122
void Update ()
2223
{
2324

25+
currentAnimation = 0;
26+
r = 0;
27+
counter++;
28+
29+
if (counter % 10 == 0) {
30+
r = Random.Range (0f, 1f);
31+
}
32+
33+
34+
//Debug.Log (counter + ", " + r);
35+
2436

2537

2638
if (Input.GetKey (KeyCode.Alpha1)) {
@@ -33,10 +45,12 @@ void Update ()
3345
currentAnimation = 4;
3446
} else if (Input.GetKey (KeyCode.Alpha5)) {
3547
currentAnimation = 5;
36-
} else {
37-
currentAnimation = 0;
3848
}
3949

50+
if (currentAnimation > 0 && r > .9f)
51+
currentAnimation = (int)Random.Range (1, 5);
52+
else
53+
currentAnimation = 0;
4054

4155
// set the animation
4256
animator.SetInteger ("state", currentAnimation);

Assets/_Project/Scripts/Players/PlayerManager.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ public void ResetPlayers ()
4545
foreach (var feed in DataManager.feeds) {
4646
CreateNewPlayer (feed.username);
4747
}
48+
49+
// trigger data updated event
50+
//EventManager.TriggerEvent ("DataUpdated");
4851
}
4952

5053
/**
@@ -91,6 +94,30 @@ public void CreateNewPlayer (string username)
9194
}
9295

9396

97+
98+
public void PlayRandomEvent ()
99+
{
100+
101+
//// get random child
102+
//Transform [] children = gameObject.GetComponentsInChildren<Transform> ();
103+
//GameObject randomObject = children [Random.Range (0, children.Length)].gameObject;
104+
105+
//// pick random anim
106+
//int randomEventIndex = (int)Random.Range (1, 5);
107+
108+
109+
110+
////GameObject PlayerCharacter = randomObject.transform.GetChild (0).gameObject;
111+
//TallyAnimController anim = randomObject.GetComponent<TallyAnimController> ();
112+
//Debug.Log (randomObject.name + " - " + randomEventIndex);
113+
//anim.currentAnimation = randomEventIndex;
114+
115+
}
116+
117+
118+
119+
120+
94121
/**
95122
* Return random Vector3 position that doesn't already have a GameObject in it
96123
*/

0 commit comments

Comments
 (0)