-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRubiksApplication.cs
47 lines (41 loc) · 1.39 KB
/
RubiksApplication.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using UnityEngine;
public class RubiksElement : MonoBehaviour
{
// Gives access to the application and all instances.
public RubiksApplication app { get { return GameObject.FindObjectOfType<RubiksApplication>(); } }
}
// Entry point for the application
public class RubiksApplication : MonoBehaviour
{
// Reference to the root instances of the MVC.
public RubiksModel model;
public RubiksView view;
public RubiksController controller;
void Awake()
{
Init();
}
// Assigning all referances.
private void Init()
{
model = transform.Find("Model").gameObject.GetComponent<RubiksModel>();
view = transform.Find("View").gameObject.GetComponent<RubiksView>();
controller = transform.Find("Controller").gameObject.GetComponent<RubiksController>();
}
public void Notify(string p_event_path, Object p_target, params object[] p_data)
{
RubiksController[] controller_list = GetAllControllers();
foreach (RubiksController c in controller_list)
{
c.OnNotification(p_event_path, p_target, p_data);
}
}
private RubiksController[] GetAllControllers()
{
return GameObject.FindObjectsOfType<RubiksController>();
}
}
/// <summary>
/// The three non-face cube groups.
/// </summary>
public enum CenterRow { Standing, Mid, Equator }