diff --git a/Assets/Art/LinkBeam.png b/Assets/Art/LinkBeam.png index 23886c7..74c4b65 100644 Binary files a/Assets/Art/LinkBeam.png and b/Assets/Art/LinkBeam.png differ diff --git a/Assets/Prefabs/FriendshipLink.prefab b/Assets/Prefabs/FriendshipLink.prefab index d3c567f..5bd9d47 100644 --- a/Assets/Prefabs/FriendshipLink.prefab +++ b/Assets/Prefabs/FriendshipLink.prefab @@ -135,7 +135,7 @@ Transform: m_PrefabInternal: {fileID: 100100000} m_GameObject: {fileID: 195142} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -.573046267, y: -.809006572, z: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 495136} @@ -151,15 +151,13 @@ MonoBehaviour: m_GameObject: {fileID: 195142} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: c495d00d780bd3d49866ec60f5efbf66, type: 3} + m_Script: {fileID: 11500000, guid: 9c9bbff116cac264d9d7fdcce8cf92e5, type: 3} m_Name: m_EditorClassIdentifier: - HighlightedColor: {r: 1, g: 1, b: 1, a: .501960814} + HighlightedColor: {r: 1, g: 1, b: 1, a: .258823544} StartPoint: {fileID: 495136} EndPoint: {fileID: 495134} BeamLine: {fileID: 12095142} - StartObject: {fileID: 0} - EndObject: {fileID: 0} --- !u!120 &12095142 LineRenderer: m_ObjectHideFlags: 1 diff --git a/Assets/Prefabs/NetworkingSphere.prefab b/Assets/Prefabs/NetworkingSphere.prefab index 94c7961..60c3796 100644 --- a/Assets/Prefabs/NetworkingSphere.prefab +++ b/Assets/Prefabs/NetworkingSphere.prefab @@ -88,12 +88,14 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d0907c1567bad554c8b995de3459e517, type: 3} m_Name: m_EditorClassIdentifier: - LinkObj: {fileID: 11495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2} - PersonObj: {fileID: 11417564, guid: 7a5b1db47a2c30e419038df40dffa79a, type: 2} - NumPeople: 50 - AvgNumFriends: 8 - FriendshipLikeliness: .400000006 - SphereRadius: 7 + gameObjects: + LinkObj: {fileID: 11495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2} + PersonObj: {fileID: 11417564, guid: 7a5b1db47a2c30e419038df40dffa79a, type: 2} + levelOptions: + NumPeople: 50 + AvgNumFriends: 8 + FriendshipLikeliness: .400000006 + SphereRadius: 7 rotationSpeed: .699999988 torqueForce: 1 DetailsPanel: {fileID: 0} diff --git a/Assets/Prefabs/PersonDetailsPanel.prefab b/Assets/Prefabs/PersonDetailsPanel.prefab index fc2a19e..0701142 100644 --- a/Assets/Prefabs/PersonDetailsPanel.prefab +++ b/Assets/Prefabs/PersonDetailsPanel.prefab @@ -395,7 +395,19 @@ MonoBehaviour: m_TargetGraphic: {fileID: 11443318} m_OnClick: m_PersistentCalls: - m_Calls: [] + m_Calls: + - m_Target: {fileID: 11476684} + m_MethodName: KillNode + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine, Version=0.0.0.0, + Culture=neutral, PublicKeyToken=null + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null --- !u!114 &11411578 @@ -457,8 +469,8 @@ MonoBehaviour: m_TargetGraphic: {fileID: 11431992} m_HandleRect: {fileID: 22417254} m_Direction: 2 - m_Value: 1 - m_Size: .427392095 + m_Value: .999378026 + m_Size: .427392036 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -1093,7 +1105,7 @@ RectTransform: m_RootOrder: 0 m_AnchorMin: {x: .5, y: 1} m_AnchorMax: {x: .5, y: 1} - m_AnchoredPosition: {x: 0, y: -65.9999924} + m_AnchoredPosition: {x: 0, y: -65.95298} m_SizeDelta: {x: 90, y: 132} m_Pivot: {x: .5, y: .5} --- !u!224 &22462244 diff --git a/Assets/Prefabs/PersonNode.prefab b/Assets/Prefabs/PersonNode.prefab index a312410..51bf4c8 100644 --- a/Assets/Prefabs/PersonNode.prefab +++ b/Assets/Prefabs/PersonNode.prefab @@ -62,7 +62,7 @@ Transform: m_PrefabInternal: {fileID: 100100000} m_GameObject: {fileID: 193868} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: -544.163269, y: -235.973114, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 496448} @@ -75,8 +75,8 @@ Transform: m_PrefabInternal: {fileID: 100100000} m_GameObject: {fileID: 136744} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: -9.99999975e-05} - m_LocalScale: {x: .899999976, y: .899999976, z: 1} + m_LocalPosition: {x: 0, y: 0, z: -.00100000005} + m_LocalScale: {x: .800000012, y: .800000012, z: 1} m_Children: - {fileID: 498100} m_Father: {fileID: 410576} diff --git a/Assets/Scenes/Gameplay.unity b/Assets/Scenes/Gameplay.unity index 810ad66..541cd25 100644 --- a/Assets/Scenes/Gameplay.unity +++ b/Assets/Scenes/Gameplay.unity @@ -431,12 +431,12 @@ CanvasRenderer: RectTransform: m_PrefabParentObject: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} - m_PrefabInternal: {fileID: 1267491657} + m_PrefabInternal: {fileID: 1009381200} --- !u!114 &724043967 stripped MonoBehaviour: m_PrefabParentObject: {fileID: 11476684, guid: c993e87661906234fba410e55ed66832, type: 2} - m_PrefabInternal: {fileID: 1267491657} + m_PrefabInternal: {fileID: 1009381200} m_Script: {fileID: 11500000, guid: 88fb1885d6f8fd6409e3866b7707a12a, type: 3} --- !u!1 &997683484 GameObject: @@ -500,6 +500,100 @@ CanvasRenderer: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 997683484} +--- !u!1001 &1009381200 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 523974151} + m_Modifications: + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_AnchorMin.x + value: .0299999993 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_AnchorMin.y + value: .0299999993 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_AnchorMax.x + value: .970000029 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_AnchorMax.y + value: .970000029 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_Pivot.x + value: .5 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_Pivot.y + value: .5 + objectReference: {fileID: 0} + - target: {fileID: 22417254, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22417254, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22417254, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: c993e87661906234fba410e55ed66832, type: 2} + m_IsPrefabParent: 0 --- !u!1 &1057734534 GameObject: m_ObjectHideFlags: 0 @@ -651,100 +745,6 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_RootOrder: 1 ---- !u!1001 &1267491657 -Prefab: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 523974151} - m_Modifications: - - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_RootOrder - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_AnchoredPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_AnchoredPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_SizeDelta.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_SizeDelta.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_AnchorMin.x - value: .0299999993 - objectReference: {fileID: 0} - - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_AnchorMin.y - value: .0299999993 - objectReference: {fileID: 0} - - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_AnchorMax.x - value: .970000029 - objectReference: {fileID: 0} - - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_AnchorMax.y - value: .970000029 - objectReference: {fileID: 0} - - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_Pivot.x - value: .5 - objectReference: {fileID: 0} - - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_Pivot.y - value: .5 - objectReference: {fileID: 0} - - target: {fileID: 22417254, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_AnchorMin.y - value: .572607875 - objectReference: {fileID: 0} - - target: {fileID: 22417254, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_AnchorMax.x - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 22417254, guid: c993e87661906234fba410e55ed66832, type: 2} - propertyPath: m_AnchorMax.y - value: 1 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 100100000, guid: c993e87661906234fba410e55ed66832, type: 2} - m_IsPrefabParent: 0 --- !u!1 &1413393085 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/FriendshipLink.cs b/Assets/Scripts/Link.cs similarity index 53% rename from Assets/Scripts/FriendshipLink.cs rename to Assets/Scripts/Link.cs index 1275422..f2730c9 100644 --- a/Assets/Scripts/FriendshipLink.cs +++ b/Assets/Scripts/Link.cs @@ -1,11 +1,22 @@ using UnityEngine; -using System.Collections; +using System.Collections; +using DeathBook.Util; +using DeathBook.Model; [RequireComponent(typeof(LineRenderer))] -public class FriendshipLink : MonoBehaviour -{ - public Color HighlightedColor = new Color(1f, 1f, 1f, 0.5f); - +public class Link : MonoBehaviour, IObserver +{ + private float highlightAlpha = 0.8f; + private float defaultAlpha = 0.5f; + + private Color currentDefaultColor; + private Color currentHighlightColor; + + private static float defaultScale = 0.03f; + private float hightlightScale = 0.2f; + + private bool isHighlighted = false; + [SerializeField] private Transform StartPoint; @@ -16,16 +27,28 @@ public class FriendshipLink : MonoBehaviour private LineRenderer BeamLine; //public ParticleSystem BeamParticles; - [SerializeField] private Transform StartObject; - - [SerializeField] - private Transform EndObject; + private Transform EndObject; + + private FriendshipLink model; + public FriendshipLink Model + { + get { return model; } + set + { + model = value; + model.Subscribe(this); + + //Make it between 0.1 and 0.4 + GetColors(Model.Awareness); + hightlightScale = Model.Importance * 0.3f + 0.1f; + Highlight(false); + } + } private float LIFETIME_RATIO = 0.025f; private Renderer _renderer; - private Color _defaultColor; void Awake() { @@ -36,14 +59,21 @@ public class FriendshipLink : MonoBehaviour _renderer.material = Instantiate(_renderer.material); - _defaultColor = _renderer.material.GetColor("_TintColor"); + //_defaultColor = _renderer.material.GetColor("_TintColor"); //Activate(false); - } + } + + public void Notify() + { + GetColors(Model.Awareness); + UpdateBeam(); + //TODO SR + } void Update() - { - UpdateVisualEffects(); + { + UpdateVisualEffects(); } public void Activate(bool state) @@ -79,10 +109,35 @@ public class FriendshipLink : MonoBehaviour EndObject = destination.transform; } - public void Highlight(bool state, float weight) - { - // For now, the weight does nothing but it should eventually influence the intensity and size of the link - - _renderer.material.SetColor("_TintColor", state ? HighlightedColor : _defaultColor); - } + public void Highlight(bool state) + { +; isHighlighted = state; + UpdateBeam(); + } + + private void GetColors(float level) + { + //If level is 0.0, green [0,1,0]. + //If level is 0.5, yellow [1,1,0]. + //If level is 1.0, red [1,0,0]. + + float r = 1f; + float g = 1f; + + if (level < 0.5f) + r = Mathf.Lerp(0, 1, level*2); + else + g = Mathf.Lerp(1, 0, level * 2 - 1); + + currentDefaultColor = new Color(r, g, 0f, defaultAlpha); + currentHighlightColor = new Color(r, g, 0f, highlightAlpha); + } + + private void UpdateBeam() + { + float width = isHighlighted ? hightlightScale : defaultScale; + BeamLine.SetWidth(width, width); + + _renderer.material.SetColor("_TintColor", isHighlighted ? currentHighlightColor : currentDefaultColor); + } } diff --git a/Assets/Tests/SphereSR.cs.meta b/Assets/Scripts/Link.cs.meta similarity index 76% rename from Assets/Tests/SphereSR.cs.meta rename to Assets/Scripts/Link.cs.meta index d55f23a..a0b7e66 100644 --- a/Assets/Tests/SphereSR.cs.meta +++ b/Assets/Scripts/Link.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: a24d489629b440b4d9fcfafc24239241 -timeCreated: 1439446791 +guid: 9c9bbff116cac264d9d7fdcce8cf92e5 +timeCreated: 1439591140 licenseType: Free MonoImporter: serializedVersion: 2 diff --git a/Assets/Scripts/Models/Friendship.cs b/Assets/Scripts/Models/Friendship.cs index a5563a9..a1ff053 100644 --- a/Assets/Scripts/Models/Friendship.cs +++ b/Assets/Scripts/Models/Friendship.cs @@ -1,18 +1,61 @@ using System; using System.Collections.Generic; +using UnityEngine; +using DeathBook.Util; namespace DeathBook.Model { - public class Friendship + public class Friendship : Updatable { - public Person friend1, friend2; - private int importance; //on a scale from 1 to 100 + private Person self; + public Person Self { get { return self; } } + private Person friend; + public Person Friend { get { return friend; } } + + private Friendship other; + public Friendship Other { get { return other; } set { other = value; } } - public Friendship(Person p1, Person p2, int scale) + private FriendshipLink link; + public FriendshipLink Link { get { return link; } } + + private bool noticedDeath = false; + + public Friendship(Person self, Person friend, FriendshipLink link) { - friend1 = p1; - friend2 = p2; - importance = scale; + this.self = self; + this.friend = friend; + this.link = link; } + + public void Update(float deltaTime) + { + if (noticedDeath) + return; + + //This function is only called when friend is dead + //awareness = Mathf.Min(awareness + deltaTime * CalculateWeight(), 1); + link.Awareness = Mathf.Min(link.Awareness + deltaTime * 0.1f, 1f); + if (link.Awareness >= 1f) + { + self.NoticeDeath(this); + noticedDeath = true; + } + } + + //returns a number between 0 and 1 + private float CalculateWeight() + { + float weight = 0; + + weight += link.Importance; + //weight += friend.TimeBetweenPosts; + + return weight * 0.1f; + } + + /*internal enum Knowledge + { + Alive, Doubt, Dead + }*/ } } diff --git a/Assets/Scripts/Models/FriendshipLink.cs b/Assets/Scripts/Models/FriendshipLink.cs new file mode 100644 index 0000000..231a861 --- /dev/null +++ b/Assets/Scripts/Models/FriendshipLink.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using DeathBook.Util; + +namespace DeathBook.Model +{ + public class FriendshipLink : Observable + { + private Person friend1, friend2; + public Person Friend1 { get { return friend1; } } + public Person Friend2 { get { return friend2; } } + + private float importance; //on a scale from 0 to 1 + public float Importance { get { return importance; } } + + private float awareness = 0; //on a scale from 0 to 1 + public float Awareness + { + get { return awareness; } + set { awareness = value; NotifyObservers(); } + } + + public FriendshipLink(Person p1, Person p2, float importance) + { + friend1 = p1; + friend2 = p2; + this.importance = importance; + } + } +} diff --git a/Assets/Scripts/FriendshipLink.cs.meta b/Assets/Scripts/Models/FriendshipLink.cs.meta similarity index 76% rename from Assets/Scripts/FriendshipLink.cs.meta rename to Assets/Scripts/Models/FriendshipLink.cs.meta index 71c5c31..1ef5d1f 100644 --- a/Assets/Scripts/FriendshipLink.cs.meta +++ b/Assets/Scripts/Models/FriendshipLink.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: c495d00d780bd3d49866ec60f5efbf66 -timeCreated: 1439307989 +guid: 5c672f95914b3f04088de0f562834941 +timeCreated: 1439578834 licenseType: Free MonoImporter: serializedVersion: 2 diff --git a/Assets/Scripts/Models/Level.cs b/Assets/Scripts/Models/Level.cs index ba99bd7..83b74b1 100644 --- a/Assets/Scripts/Models/Level.cs +++ b/Assets/Scripts/Models/Level.cs @@ -1,24 +1,40 @@ using UnityEngine; using System.Collections.Generic; +using DeathBook.Util; namespace DeathBook.Model { - public class Level + public class Level : Observable, Updatable { + private const float TimeScale = 30f; + private int score; + public int Score { get { return score; } } - public List people; - public List friendships; + private List people; + public List People { get { return people; } } + private List friendships; + public List Friendships { get { return friendships; } } + //1 = 1 minute + private float gameTime; + public int GameTime { get { return (int)(gameTime * TimeScale); } } - //private Generator gen; - private int gameTime; - private int globalAwareness; + private float globalAwareness; //on a scale from 0 to 1 + public float GlobalAwareness { get { return globalAwareness; } } - public Level(List people, List friendships) + public Level(List people, List friendships) { this.people = people; this.friendships = friendships; } + + public void Update(float deltaTime) + { + gameTime += deltaTime; + NotifyObservers(); + + //TODO Global awareness - start trends + } } } diff --git a/Assets/Scripts/Models/LevelGenerator.cs b/Assets/Scripts/Models/LevelGenerator.cs index 6e8ffb3..b380224 100644 --- a/Assets/Scripts/Models/LevelGenerator.cs +++ b/Assets/Scripts/Models/LevelGenerator.cs @@ -10,6 +10,9 @@ namespace DeathBook.Model private float probability; private float radius; + private const float minConnTime = 3; + private const float maxConnTime = 20; + public Level GenerateLevel(int numPeople, int avgFriends, float probability, float radius) { this.numPeople = numPeople; @@ -18,7 +21,7 @@ namespace DeathBook.Model this.radius = radius; List people = CreatePeople(); - List friendships = CreateFriendships(people); + List friendships = CreateFriendships(people); return new Level(people, friendships); } @@ -48,7 +51,8 @@ namespace DeathBook.Model x = Mathf.Cos(longitude) * r; y = Mathf.Sin(longitude) * r; - p = new Person(i, x, y, z); + p = CreatePerson(i, x, y, z); + people.Add(p); z -= dz; @@ -56,16 +60,12 @@ namespace DeathBook.Model longitude += dlong; } - Debug.Log("People: " + people.Count); - return people; } - private List CreateFriendships(List people) + private List CreateFriendships(List people) { - Debug.Log("Creating friendships" + probability); - - List friendships = new List(); + List friendships = new List(); Person p1, p2; int totalCount = people.Count; @@ -76,7 +76,7 @@ namespace DeathBook.Model for (int i = 0; i < totalCount; i++) { p1 = people[i]; - missing = avgConnections - p1.numFriends; // TODO Add randomness + missing = avgConnections - p1.FriendCount; // TODO Add randomness if (missing <= 0) continue; @@ -86,7 +86,7 @@ namespace DeathBook.Model for (int j = i+1; j < totalCount; j++) { p2 = people[j]; - if (p2.numFriends < avgConnections * 1.2) + if (p2.FriendCount < avgConnections * 1.2) list.AddLast(new DistanceNode(p1, p2)); } @@ -112,17 +112,33 @@ namespace DeathBook.Model list.Remove(smallest); } } - Debug.Log(friendships.Count); + return friendships; } - private Friendship CreateFriendship(Person p1, Person p2) + private FriendshipLink CreateFriendship(Person p1, Person p2) { - Friendship f = new Friendship(p1, p2, Random.Range(1,100)); - p1.AddFriendship(f); - p2.AddFriendship(f); + FriendshipLink f = new FriendshipLink(p1, p2, Random.value); + Friendship f1 = new Friendship(p1, p2, f); + Friendship f2 = new Friendship(p2, p1, f); + f1.Other = f2; + f2.Other = f1; + + p1.AddFriendship(f1); + p2.AddFriendship(f2); + return f; } + + private Person CreatePerson(int id, float x, float y, float z) + { + Vector3 pos = new Vector3(x, y, z); + //Vector2 times = + + Person p = new Person(id, pos); + + return p; + } } internal class DistanceNode @@ -133,19 +149,7 @@ namespace DeathBook.Model public DistanceNode(Person p1, Person p2) { p = p2; - dist = (p2.initialPosition - p1.initialPosition).sqrMagnitude; + dist = (p2.InitialPosition - p1.InitialPosition).sqrMagnitude; } } - - - /* - * 1. Friendship urgency - 0-1 - * Number of friends missing - * VS number of nodes left - * - * 2. Friendship possibility - * Closeness - * 0 < distance^2 < root(2)*rSq < 4*rSq - * - */ } diff --git a/Assets/Scripts/Models/LevelManager.cs b/Assets/Scripts/Models/LevelManager.cs new file mode 100644 index 0000000..393cd01 --- /dev/null +++ b/Assets/Scripts/Models/LevelManager.cs @@ -0,0 +1,23 @@ +using UnityEngine; +using System.Collections.Generic; + +namespace DeathBook.Model +{ + public class LevelManager + { + private static LevelManager instance = new LevelManager(); + public static LevelManager Instance { get {return instance; } } + + private Level level = null; + public Level GameLevel { get { return level; } } + + private LevelGenerator gen = new LevelGenerator(); + + private LevelManager() {} + + public void NewLevel(int numPeople, int avgFriends, float probability, float radius) + { + level = gen.GenerateLevel(numPeople, avgFriends, probability, radius); + } + } +} diff --git a/Assets/Scripts/Models/LevelManager.cs.meta b/Assets/Scripts/Models/LevelManager.cs.meta new file mode 100644 index 0000000..ed2c179 --- /dev/null +++ b/Assets/Scripts/Models/LevelManager.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ccfb5fe3d9ad971499b807bde15217c4 +timeCreated: 1439591141 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Models/Person.cs b/Assets/Scripts/Models/Person.cs index 0e47446..27a0b1f 100644 --- a/Assets/Scripts/Models/Person.cs +++ b/Assets/Scripts/Models/Person.cs @@ -1,92 +1,124 @@ using UnityEngine; using System.Collections.Generic; using System; +using DeathBook.Util; namespace DeathBook.Model { - public class Person : Observable + public class Person : Observable, Updatable { + public Action OnSelected; + public int id; - private string name; - private List friendList = new List(); - public Vector3 initialPosition; - public int numFriends; + public int Id { get { return id; } } + + private string firstName; + private string lastName; + public string Name { get { return firstName + " " + lastName; } } + public string FirstName { get { return firstName; } } + + private Vector3 initialPosition; + public Vector3 InitialPosition { get { return initialPosition; } } + + private List friendsList = new List(); + public List FriendList { get { return friendsList; } } + private List deadFriendsList = new List(); + public List DeadFriendList { get { return deadFriendsList; } } + + private int numAliveFriends = 0; + private int numDeadFriends = 0; + private int friendCount = 0; + public int FriendCount { get { return friendCount; } } + private int timeBetweenPosts; // f = 1/T; - private int connectionTime; - private int disconnectionTime; - private int awarenessLevel; - private bool alive; + public int TimeBetweenPosts { get { return timeBetweenPosts; } } - private int happiness; - private bool connected; + private float connectionTime; + public float ConnectionTime { get { return connectionTime; } } - private Sprite picture; + private float disconnectionTime; + public float DisconnectionTime { get { return disconnectionTime; } } - //private Node node; + private float awarenessLevel = 0; //on a scale from 0 to 1 + public float AwarenessLevel { get { return awarenessLevel; } } - public string Name - { - get { return name; } - } + private bool alive = true; + public bool Alive { get { return alive; } } - public bool Alive - { - get { return alive; } - } + private bool online = true; + public bool Online { get { return online; } } + + private Sprite picture; + public Sprite Picture { get { return picture; } } - public int AwarenessLevel - { - get { return awarenessLevel; } - } - public List FriendList - { - get { return friendList; } - } - - public int FriendsCount - { - get { return numFriends; } - } - - public bool Online - { - get { return connected; } - } - - public Sprite Picture - { - get { return picture; } - } - - public Person(int id, float x, float y, float z) + public Person(int id, Vector3 pos) { this.id = id; - initialPosition = new Vector3(x, y, z); - alive = true; + initialPosition = pos; - // For testing purposes - picture = UnityEngine.Random.Range(0, 2) == 0 ? PictureGenerator.GetFemalePicture() : PictureGenerator.GetMalePicture(); + // TODO Use names from db + firstName = "Mark"; + lastName = "Zuckerberg"; - // Temporary - name = String.Format("Firstname{0} Lastname{0}", id); + // For testing purposes + picture = UnityEngine.Random.Range(0, 2) == 0 ? PictureGenerator.GetFemalePicture() : PictureGenerator.GetMalePicture(); } public void AddFriendship(Friendship f) { - friendList.Add(f); - numFriends++; + friendsList.Add(f); + numAliveFriends++; + friendCount++; } - private bool isConnected(int time) + public void NotifyFriendWasKilled(Friendship f) { - return disconnectionTime > time && time > connectionTime; + //Debug.Log("I am " + id + " and my friend " + f.Friend.Id + " was killed"); + numAliveFriends--; + numDeadFriends++; + deadFriendsList.Add(f); } - private int calculateWeight() + public void Kill() { - //friendCount * ____ + 1/timeBetweenPosts + } - return 0; + //Debug.Log("Person " + id + " died!"); + alive = false; + foreach (Friendship f in friendsList) + f.Friend.NotifyFriendWasKilled(f.Other); + NotifyObservers(); } + + public void NoticeDeath(Friendship f) + { + //TODO apply more rules here + awarenessLevel = Mathf.Min(AwarenessLevel + 0.2f, 1f); + //Debug.Log("I am " + id + " and I know my friend " + f.Friend.Id + " was killed.. " + AwarenessLevel); + //TODO remove from dead friends list to accelerate + NotifyObservers(); + } + + public void Update(float deltaTime) + { + //TODO Update if connected + int time = LevelManager.Instance.GameLevel.GameTime; + + + + //The following actions are only performed if user is online + if (!Online) + return; + + foreach (Friendship f in deadFriendsList) + f.Update(deltaTime); + } + + public void SelectNode() + { + if (OnSelected != null) + { + OnSelected(); + } + } } } \ No newline at end of file diff --git a/Assets/Scripts/Models/Utils.cs b/Assets/Scripts/Models/Utils.cs new file mode 100644 index 0000000..08f33ca --- /dev/null +++ b/Assets/Scripts/Models/Utils.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace DeathBook.Model +{ + public class Utils + { + public static void Test() + { + float mean = 50; + float range = 50; + int numSteps = 2; + + int numTries = 100; + + for (int i = 0; i < numTries; i++) + { + Debug.Log(GetRandomValue(mean, range, numSteps)); + } + } + + public static float GetRandomValue(float mean, float range, int numSteps) + { + float sum = 0; + for (int i = 0; i < numSteps; i++) + { + sum += Random.value; + } + return (sum / numSteps * 2 - 1) * range + mean; + } + } +} diff --git a/Assets/Scripts/Models/Utils.cs.meta b/Assets/Scripts/Models/Utils.cs.meta new file mode 100644 index 0000000..18e99e8 --- /dev/null +++ b/Assets/Scripts/Models/Utils.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 710c7285af897124a8e7e5c5ecf05109 +timeCreated: 1439506723 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NetworkingSphere.cs b/Assets/Scripts/NetworkingSphere.cs index 2076501..d143c66 100644 --- a/Assets/Scripts/NetworkingSphere.cs +++ b/Assets/Scripts/NetworkingSphere.cs @@ -5,14 +5,27 @@ using DeathBook.Model; public class NetworkingSphere : MonoBehaviour { - public FriendshipLink LinkObj; - public PersonNode PersonObj; - public int NumPeople = 50; - public int AvgNumFriends = 20; - public float FriendshipLikeliness = 0.4f; - public float SphereRadius = 1f; - public float rotationSpeed = 0.7f; + public GameObjectsOptions gameObjects = new GameObjectsOptions(); + public LevelOptions levelOptions = new LevelOptions(); + private NetworkDisconnection sphere; + [System.Serializable] + public class GameObjectsOptions + { + public Link LinkObj; + public PersonNode PersonObj; + } + + [System.Serializable] + public class LevelOptions + { + public int NumPeople = 50; + public int AvgNumFriends = 20; + public float FriendshipLikeliness = 0.4f; + public float SphereRadius = 1f; + } + + public float rotationSpeed = 0.7f; public float torqueForce = 50f; public PersonDetailsPanel DetailsPanel; @@ -21,23 +34,35 @@ public class NetworkingSphere : MonoBehaviour private Vector3 delta = new Vector3(); private Rigidbody rb; + private LevelManager manager; + private PersonNode[] peopleNodes; - //TODO private Friendship[] friendships; private PersonNode _selectedNode; + // Used to disable the physics when the user has clicked on a node + private bool _isRotatingTowardsNode = false; + void Awake() { - LevelGenerator lGen = new LevelGenerator(); - Level lvl = lGen.GenerateLevel(NumPeople, AvgNumFriends, FriendshipLikeliness, SphereRadius); + manager = LevelManager.Instance; + manager.NewLevel(levelOptions.NumPeople, levelOptions.AvgNumFriends, levelOptions.FriendshipLikeliness, levelOptions.SphereRadius); + Level lvl = manager.GameLevel; InstantiateNodes(lvl); AssignLinks(lvl); rb = GetComponent(); } + /*void OnGUI() + { + GUI.Button(new Rect(10, 100, 400, 40), manager.GameLevel.GameTime + ""); + }*/ + void Update() { + manager.GameLevel.Update(Time.deltaTime); + //TEMPORARY QUICK FIX: Even though we are never moving the sphere, it starts moving as soon as it stops rotating transform.position = Vector3.zero; @@ -48,12 +73,12 @@ public class NetworkingSphere : MonoBehaviour Vector3 worldMousePos = Camera.main.ScreenToWorldPoint(screenMousePos); // If the world position of the mouse is greater than the radius of the sphere, we are outside - if (Mathf.Sqrt(worldMousePos.x * worldMousePos.x + worldMousePos.y * worldMousePos.y) > SphereRadius + 1f) + if (Mathf.Sqrt(worldMousePos.x * worldMousePos.x + worldMousePos.y * worldMousePos.y) > levelOptions.SphereRadius + 1f) { transform.Rotate(Vector3.one * Time.deltaTime * rotationSpeed); } - //when right btn clicked, call MoveSphere + //when right btn clicked, call the change rotation if (Input.GetMouseButtonDown(1)) { dragging = true; @@ -64,20 +89,21 @@ public class NetworkingSphere : MonoBehaviour delta = new Vector3(); } - if (dragging) + if (dragging && !_isRotatingTowardsNode) { MoveSphere(); } - //scroll - if (Input.GetAxis("Mouse ScrollWheel") != 0) - { - // if (Camera.main.ScreenToViewportPoint(Input.mousePosition) < new Vector3(1,1,1)) - if (Camera.main.ScreenToViewportPoint(Input.mousePosition).x < 1) - { - Camera.main.fieldOfView -= Input.GetAxis("Mouse ScrollWheel") * 10f; - } - } + + //scroll + if (Input.GetAxis("Mouse ScrollWheel") != 0) + { + // if (Camera.main.ScreenToViewportPoint(Input.mousePosition) < new Vector3(1,1,1)) + if (Camera.main.ScreenToViewportPoint(Input.mousePosition).x < 1) + { + Camera.main.fieldOfView -= Input.GetAxis("Mouse ScrollWheel") * 10f; + } + } } void MoveSphere() @@ -97,13 +123,13 @@ public class NetworkingSphere : MonoBehaviour private void InstantiateNodes(Level lvl) { - peopleNodes = new PersonNode[lvl.people.Count]; + peopleNodes = new PersonNode[lvl.People.Count]; - for (int i = 0; i < lvl.people.Count; i++) + for (int i = 0; i < lvl.People.Count; i++) { - Person person = lvl.people[i]; + Person person = lvl.People[i]; - PersonNode pInst = Instantiate(PersonObj, person.initialPosition, Quaternion.identity) as PersonNode; + PersonNode pInst = Instantiate(gameObjects.PersonObj, person.InitialPosition, Quaternion.identity) as PersonNode; pInst.OnClicked += OnNodeClicked; @@ -116,6 +142,8 @@ public class NetworkingSphere : MonoBehaviour private void OnNodeClicked(PersonNode node) { + if (node == _selectedNode) return; + if (_selectedNode != null) { _selectedNode.Select(false); @@ -132,11 +160,12 @@ public class NetworkingSphere : MonoBehaviour private void AssignLinks(Level lvl) { - foreach (Friendship f in lvl.friendships) + foreach (FriendshipLink f in lvl.Friendships) { - FriendshipLink link = Instantiate(LinkObj) as FriendshipLink; - int id1 = f.friend1.id; - int id2 = f.friend2.id; + Link link = Instantiate(gameObjects.LinkObj) as Link; + int id1 = f.Friend1.id; + int id2 = f.Friend2.id; + link.Model = f; link.AttachToObjects(peopleNodes[id1].gameObject, peopleNodes[id2].gameObject); // Temporary stuff, for testing @@ -171,6 +200,9 @@ public class NetworkingSphere : MonoBehaviour private IEnumerator RotateTowardsNodeCoroutine(PersonNode node) { + _isRotatingTowardsNode = true; + rb.angularVelocity = Vector3.zero; + //Vector3 finalPos = new Vector3(0f, 0f, -SphereRadius); Quaternion initialRot = transform.localRotation; @@ -184,10 +216,10 @@ public class NetworkingSphere : MonoBehaviour Vector3 longDir = nodePos; longDir.y = 0; - float longitude = Vector3.Angle(-Vector3.forward, longDir) * (longDir.x < 0 ? -1 : 1); - float latitude = Mathf.Asin(nodePos.normalized.y) * Mathf.Rad2Deg; + float xAngle = Mathf.Asin(nodePos.normalized.y) * Mathf.Rad2Deg; // Latitude + float yAngle = Vector3.Angle(-Vector3.forward, longDir) * (longDir.x < 0 ? -1 : 1); // Longitude - Quaternion finalRot = Quaternion.AngleAxis(-latitude, Vector3.right) * Quaternion.AngleAxis(longitude, Vector3.up); + Quaternion finalRot = Quaternion.AngleAxis(-xAngle, Vector3.right) * Quaternion.AngleAxis(yAngle, Vector3.up); float ratio = 0f; @@ -199,5 +231,7 @@ public class NetworkingSphere : MonoBehaviour yield return null; } + + _isRotatingTowardsNode = false; } } diff --git a/Assets/Scripts/ObserverPattern/IObservable.cs b/Assets/Scripts/ObserverPattern/IObservable.cs index b4e01a2..b896eb0 100644 --- a/Assets/Scripts/ObserverPattern/IObservable.cs +++ b/Assets/Scripts/ObserverPattern/IObservable.cs @@ -1,30 +1,33 @@ -using System.Collections.Generic; - -// Using an abstract class to avoid repeating code, but could be implemented as an interface if inheritance is somehow needed for the subjects -public abstract class Observable -{ - private List observers; - - public Observable() - { - observers = new List(); - } - - public void Subscribe(IObserver observer) - { - observers.Add(observer); - } - - public void UnSubscribe(IObserver observer) - { - observers.Remove(observer); - } - - public void NotifyObservers() - { - foreach (IObserver observer in observers) - { - observer.Notify(); - } - } +using System.Collections.Generic; + +namespace DeathBook.Util +{ + // Using an abstract class to avoid repeating code, but could be implemented as an interface if inheritance is somehow needed for the subjects + public abstract class Observable + { + private List observers; + + public Observable() + { + observers = new List(); + } + + public void Subscribe(IObserver observer) + { + observers.Add(observer); + } + + public void UnSubscribe(IObserver observer) + { + observers.Remove(observer); + } + + public void NotifyObservers() + { + foreach (IObserver observer in observers) + { + observer.Notify(); + } + } + } } diff --git a/Assets/Scripts/ObserverPattern/IObserver.cs b/Assets/Scripts/ObserverPattern/IObserver.cs index 0f7baeb..d271d55 100644 --- a/Assets/Scripts/ObserverPattern/IObserver.cs +++ b/Assets/Scripts/ObserverPattern/IObserver.cs @@ -1,4 +1,7 @@ -public interface IObserver -{ - void Notify(); +namespace DeathBook.Util +{ + public interface IObserver + { + void Notify(); + } } \ No newline at end of file diff --git a/Assets/Scripts/ObserverPattern/IUpdatable.cs b/Assets/Scripts/ObserverPattern/IUpdatable.cs new file mode 100644 index 0000000..c7cf49a --- /dev/null +++ b/Assets/Scripts/ObserverPattern/IUpdatable.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace DeathBook.Util +{ + public interface Updatable + { + void Update(float deltaTime); + } +} diff --git a/Assets/Scripts/ObserverPattern/IUpdatable.cs.meta b/Assets/Scripts/ObserverPattern/IUpdatable.cs.meta new file mode 100644 index 0000000..a9a43a5 --- /dev/null +++ b/Assets/Scripts/ObserverPattern/IUpdatable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 897f94f455c7ce64394a644bd3cf070b +timeCreated: 1439591140 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/PersonDetailsPanel.cs b/Assets/Scripts/PersonDetailsPanel.cs index 3668009..aa7e182 100644 --- a/Assets/Scripts/PersonDetailsPanel.cs +++ b/Assets/Scripts/PersonDetailsPanel.cs @@ -2,6 +2,7 @@ using System.Collections; using UnityEngine.UI; using DeathBook.Model; +using DeathBook.Util; public class PersonDetailsPanel : MonoBehaviour, IObserver { @@ -13,7 +14,7 @@ public class PersonDetailsPanel : MonoBehaviour, IObserver public Button XButton; public GameObject Container; - public Image UIFriendPicture; + public UIFriendPicture FriendPicture; private PersonNode _node; private Person _model; @@ -49,6 +50,9 @@ public class PersonDetailsPanel : MonoBehaviour, IObserver { Name.text = _model.Name; + KillButton.gameObject.SetActive(_model.Alive); + WatchButton.gameObject.SetActive(_model.Alive); + foreach (Transform picture in FriendsPanel.transform) { Destroy(picture.gameObject); @@ -67,17 +71,21 @@ public class PersonDetailsPanel : MonoBehaviour, IObserver for (int i = 0; i < _model.FriendList.Count; i++) { - Person friend = _model.FriendList[i].friend1 == _model ? _model.FriendList[i].friend2 : _model.FriendList[i].friend1; + Person friend = _model.FriendList[i].Friend; - Image friendPicture = Instantiate(UIFriendPicture) as Image; + UIFriendPicture friendPicture = Instantiate(FriendPicture) as UIFriendPicture; - friendPicture.sprite = friend.Picture; + friendPicture.Model = friend; - friendPicture.transform.SetParent(FriendsPanel.transform); - friendPicture.rectTransform.anchorMin = new Vector2(0.022f, 1f - (height - 0.01f) * (i + 1) - i * 0.01f); - friendPicture.rectTransform.anchorMax = new Vector2(0.26f, (1f - height * i)); - friendPicture.rectTransform.offsetMin = Vector2.zero; - friendPicture.rectTransform.offsetMax = Vector2.zero; + Image picture = friendPicture.Picture; + + picture.sprite = friend.Picture; + + picture.transform.SetParent(FriendsPanel.transform); + picture.rectTransform.anchorMin = new Vector2(0.022f, 1f - (height - 0.01f) * (i + 1) - i * 0.01f); + picture.rectTransform.anchorMax = new Vector2(0.26f, (1f - height * i)); + picture.rectTransform.offsetMin = Vector2.zero; + picture.rectTransform.offsetMax = Vector2.zero; } } @@ -86,4 +94,9 @@ public class PersonDetailsPanel : MonoBehaviour, IObserver Container.SetActive(false); _node.Select(false); } + + public void KillNode() + { + _node.Kill(); + } } diff --git a/Assets/Scripts/PersonNode.cs b/Assets/Scripts/PersonNode.cs index 0b65516..71b3def 100644 --- a/Assets/Scripts/PersonNode.cs +++ b/Assets/Scripts/PersonNode.cs @@ -1,161 +1,178 @@ -using UnityEngine; -using System.Collections; -using System.Collections.Generic; -using DeathBook.Model; -using System; - -[RequireComponent(typeof(Collider))] -public class PersonNode : MonoBehaviour, IObserver -{ - public Action OnClicked; - - public Color SelectedColor = Color.blue; - - public Color StartColor = Color.green; - public Color MiddleColor = Color.yellow; - public Color EndColor = Color.red; - - public Renderer internQuad; - public Renderer xQuad; - - private List _links; - private bool _highlighted = false; - private bool _selected = false; - - private Person _model; - private Renderer _renderer; - private Transform _transform; - - public Person Model - { - get { return _model; } - set - { - _model = value; - _model.Subscribe(this); - UpdateInfo(); - SetProfilePicture(); - } - } - - private void SetProfilePicture() - { - internQuad.material.mainTexture = _model.Picture.texture; - internQuad.material.SetTexture("_MainTex", _model.Picture.texture); - } - - void Awake() - { - _links = new List(); - _renderer = GetComponent(); - _transform = GetComponent(); - } - - void Update() - { - // Find another way to do it if it lags to much - _transform.LookAt(new Vector3(_transform.position.x, _transform.position.y, _transform.position.z + 1)); - } - - public void AddLink(FriendshipLink link) - { - _links.Add(link); - } - - public void Select(bool state) - { - _selected = state; - UpdateLinks(state); - - if (state) - { - _renderer.material.color = SelectedColor; - } - else - { - UpdateInfo(); - } - } - - private void UpdateLinks(bool state) - { - foreach (FriendshipLink link in _links) - { - link.Highlight(state, 1f); - } - } - - public void Notify() - { - UpdateInfo(); - } - - private void UpdateInfo() - { - //If dead -> set offline until all friends are aware, then add a big red X to profile pic - if (_model.Alive) - { - xQuad.enabled = false; - SetColors(); - } - else - { - xQuad.enabled = true; - gameObject.GetComponent().material.color = new Color32(50, 50, 50, 1); - UpdateLinks(false); - } - } - - private void SetColors() - { - //set greyed out for offline - if (_model.Online) - { - internQuad.material.color = new Color32(255, 255, 255, 1); - } - else - { - internQuad.material.color = new Color32(80, 80, 80, 1); - } - - if (_model.AwarenessLevel < 0.5) - { - gameObject.GetComponent().material.color = Color.Lerp(StartColor, MiddleColor, _model.AwarenessLevel * 2); - } - else - { - gameObject.GetComponent().material.color = Color.Lerp(MiddleColor, EndColor, _model.AwarenessLevel * 2 - 1); - } - } - - void OnMouseEnter() - { - if (!_selected && !_highlighted) - { - UpdateLinks(true); - } - - _highlighted = true; - } - - void OnMouseExit() - { - if (!_selected) - { - UpdateLinks(false); - } - - _highlighted = false; - } - - void OnMouseDown() - { - // The sphere should be subscribed to this event and update the data accordingly - if (OnClicked != null) - { - OnClicked(this); - } - - Debug.Log("clicked"); - } -} +using UnityEngine; +using System.Collections; +using System.Collections.Generic; +using DeathBook.Model; +using DeathBook.Util; +using System; + +[RequireComponent(typeof(Collider))] +public class PersonNode : MonoBehaviour, IObserver +{ + private const float UpdateFrequency = 0.5f; + private float time = 0; + + public Action OnClicked; + + public Color SelectedColor = Color.blue; + + public Color StartColor = Color.green; + public Color MiddleColor = Color.yellow; + public Color EndColor = Color.red; + + public Renderer internQuad; + public Renderer xQuad; + + private List _links; + private bool _highlighted = false; + private bool _selected = false; + + private Person _model; + private Renderer _renderer; + private Transform _transform; + + + public Person Model + { + get { return _model; } + set + { + _model = value; + _model.Subscribe(this); + _model.OnSelected += () => { OnClicked(this); }; + UpdateInfo(); + SetProfilePicture(); + } + } + + private void SetProfilePicture() + { + internQuad.material.mainTexture = _model.Picture.texture; + internQuad.material.SetTexture("_MainTex", _model.Picture.texture); + } + + void Awake() + { + _links = new List(); + _renderer = GetComponent(); + _transform = GetComponent(); + } + + void Update() + { + time += Time.deltaTime; + if (time > UpdateFrequency) + { + _model.Update(time); + time = 0; + } + + // Find another way to do it if it lags to much + _transform.LookAt(new Vector3(_transform.position.x, _transform.position.y, _transform.position.z + 1)); + } + + public void AddLink(Link link) + { + _links.Add(link); + } + + public void Select(bool state) + { + _selected = state; + UpdateLinks(state); + + if (state) + { + _renderer.material.color = SelectedColor; + } + else + { + UpdateInfo(); + } + } + + private void UpdateLinks(bool isHighlighted) + { + foreach (Link link in _links) + { + link.Highlight(isHighlighted); + } + } + + public void Kill() + { + _model.Kill(); + } + + public void Notify() + { + //Debug.Log("Received notification! " + Model.AwarenessLevel); + UpdateInfo(); + } + + private void UpdateInfo() + { + //If dead -> set offline until all friends are aware, then add a big red X to profile pic + if (_model.Alive) + { + xQuad.enabled = false; + SetColors(); + } + else + { + xQuad.enabled = true; + gameObject.GetComponent().material.color = new Color32(50, 50, 50, 1); + UpdateLinks(false); + } + } + + private void SetColors() + { + //set greyed out for offline + if (_model.Online) + { + internQuad.material.color = new Color32(255, 255, 255, 1); + } + else + { + internQuad.material.color = new Color32(80, 80, 80, 1); + } + + if (_model.AwarenessLevel < 0.5) + { + gameObject.GetComponent().material.color = Color.Lerp(StartColor, MiddleColor, _model.AwarenessLevel * 2); + } + else + { + gameObject.GetComponent().material.color = Color.Lerp(MiddleColor, EndColor, _model.AwarenessLevel * 2 - 1); + } + } + + void OnMouseEnter() + { + if (!_selected && !_highlighted) + { + UpdateLinks(true); + } + + _highlighted = true; + } + + void OnMouseExit() + { + if (!_selected) + { + UpdateLinks(false); + } + + _highlighted = false; + } + + void OnMouseDown() + { + // The sphere should be subscribed to this event and update the data accordingly + if (OnClicked != null) + { + OnClicked(this); + } + } +} diff --git a/Assets/Scripts/UIFriendPicture.cs b/Assets/Scripts/UIFriendPicture.cs new file mode 100644 index 0000000..47e5196 --- /dev/null +++ b/Assets/Scripts/UIFriendPicture.cs @@ -0,0 +1,33 @@ +using UnityEngine; +using System.Collections; +using DeathBook.Model; +using UnityEngine.UI; + +[RequireComponent(typeof(Image))] +public class UIFriendPicture : MonoBehaviour +{ + private Person _model; + + public Person Model + { + get { return _model; } + set { _model = value; } + } + + private Image _picture; + + public Image Picture + { + get { return _picture; } + } + + void Awake() + { + _picture = GetComponent(); + } + + public void OnClick() + { + _model.SelectNode(); + } +} diff --git a/Assets/Scripts/UIFriendPicture.cs.meta b/Assets/Scripts/UIFriendPicture.cs.meta new file mode 100644 index 0000000..bddc54f --- /dev/null +++ b/Assets/Scripts/UIFriendPicture.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 343d57f2bac42ae48ba9722c53e5526f +timeCreated: 1439693427 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Tests/Gameplay_SR.unity b/Assets/Tests/Gameplay_SR.unity new file mode 100644 index 0000000..824d850 --- /dev/null +++ b/Assets/Tests/Gameplay_SR.unity @@ -0,0 +1,1296 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: .25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: .5, g: .5, b: .5, a: 1} + m_FogMode: 3 + m_FogDensity: .00999999978 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: .211999997, g: .226999998, b: .259000003, a: 1} + m_AmbientEquatorColor: {r: .114, g: .125, b: .133000001, a: 1} + m_AmbientGroundColor: {r: .0469999984, g: .0430000015, b: .0350000001, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: .5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!127 &3 +LevelGameManager: + m_ObjectHideFlags: 0 +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_GIWorkflowMode: 0 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 2 + m_BakeResolution: 40 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_LightmapSnapshot: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: .5 + agentHeight: 2 + agentSlope: 45 + agentClimb: .400000006 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: .166666672 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &61719360 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 61719365} + - 20: {fileID: 61719364} + - 92: {fileID: 61719363} + - 124: {fileID: 61719362} + - 81: {fileID: 61719361} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &61719361 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 61719360} + m_Enabled: 1 +--- !u!124 &61719362 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 61719360} + m_Enabled: 1 +--- !u!92 &61719363 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 61719360} + m_Enabled: 1 +--- !u!20 &61719364 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 61719360} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: .329584748, g: .33866781, b: .352941155, a: .0196078438} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: .699999988 + height: .899999976 + near clip plane: .300000012 + far clip plane: 1000 + field of view: 59 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: .0219999999 +--- !u!4 &61719365 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 61719360} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -15.1300001} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!1 &443951980 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 443951981} + - 222: {fileID: 443951983} + - 114: {fileID: 443951982} + m_Layer: 5 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &443951981 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 443951980} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2006180051} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: .800000012} + m_AnchorMax: {x: 1, y: .949999988} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!114 &443951982 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 443951980} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1} + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 0 + m_MaxSize: 40 + m_Alignment: 4 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Recent Posts +--- !u!222 &443951983 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 443951980} +--- !u!1 &466670520 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 466670521} + - 222: {fileID: 466670523} + - 114: {fileID: 466670522} + m_Layer: 5 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &466670521 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 466670520} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 523974151} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: .828599989} + m_AnchorMax: {x: 1, y: .957099974} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -3.05175781e-05, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!114 &466670522 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 466670520} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1} + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 0 + m_MaxSize: 40 + m_Alignment: 4 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Person Details +--- !u!222 &466670523 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 466670520} +--- !u!1 &523974148 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 523974151} + - 222: {fileID: 523974150} + - 114: {fileID: 523974149} + m_Layer: 5 + m_Name: PersonDetails + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &523974149 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 523974148} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: .39199999} + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &523974150 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 523974148} +--- !u!224 &523974151 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 523974148} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 466670521} + - {fileID: 724043966} + m_Father: {fileID: 1608274018} + m_RootOrder: 2 + m_AnchorMin: {x: 0, y: .200000003} + m_AnchorMax: {x: 1, y: .550000012} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!1 &534364716 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 534364717} + - 222: {fileID: 534364719} + - 114: {fileID: 534364718} + m_Layer: 5 + m_Name: TopUI + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &534364717 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 534364716} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1057734538} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: .899999976} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!114 &534364718 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 534364716} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: .39199999} + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &534364719 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 534364716} +--- !u!224 &724043966 stripped +RectTransform: + m_PrefabParentObject: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, + type: 2} + m_PrefabInternal: {fileID: 1009381200} +--- !u!114 &724043967 stripped +MonoBehaviour: + m_PrefabParentObject: {fileID: 11476684, guid: c993e87661906234fba410e55ed66832, + type: 2} + m_PrefabInternal: {fileID: 1009381200} + m_Script: {fileID: 11500000, guid: 88fb1885d6f8fd6409e3866b7707a12a, type: 3} +--- !u!1 &997683484 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 997683485} + - 222: {fileID: 997683487} + - 114: {fileID: 997683486} + m_Layer: 5 + m_Name: Trending + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &997683485 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 997683484} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2116360766} + m_Father: {fileID: 1608274018} + m_RootOrder: 1 + m_AnchorMin: {x: 0, y: .550000012} + m_AnchorMax: {x: 1, y: .699999988} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!114 &997683486 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 997683484} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: .39199999} + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &997683487 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 997683484} +--- !u!1001 &1009381200 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 523974151} + m_Modifications: + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_AnchorMin.x + value: .0299999993 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_AnchorMin.y + value: .0299999993 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_AnchorMax.x + value: .970000029 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_AnchorMax.y + value: .970000029 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_Pivot.x + value: .5 + objectReference: {fileID: 0} + - target: {fileID: 22436630, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_Pivot.y + value: .5 + objectReference: {fileID: 0} + - target: {fileID: 22417254, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_AnchorMin.y + value: .590630949 + objectReference: {fileID: 0} + - target: {fileID: 22417254, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 22417254, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_AnchorMax.y + value: .999632359 + objectReference: {fileID: 0} + - target: {fileID: 11414010, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_Value + value: .999377966 + objectReference: {fileID: 0} + - target: {fileID: 11414010, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_Size + value: .40900141 + objectReference: {fileID: 0} + - target: {fileID: 11458616, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_Sprite + value: + objectReference: {fileID: 21300000, guid: 0c813218655d0a1468d7269b69deb9d5, + type: 3} + - target: {fileID: 11402414, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_Sprite + value: + objectReference: {fileID: 21300000, guid: 0c813218655d0a1468d7269b69deb9d5, + type: 3} + - target: {fileID: 11450318, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_Sprite + value: + objectReference: {fileID: 21300000, guid: 0c813218655d0a1468d7269b69deb9d5, + type: 3} + - target: {fileID: 11469610, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_Sprite + value: + objectReference: {fileID: 21300000, guid: 0c813218655d0a1468d7269b69deb9d5, + type: 3} + - target: {fileID: 22458514, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: m_AnchoredPosition.y + value: -65.9512177 + objectReference: {fileID: 0} + - target: {fileID: 11476684, guid: c993e87661906234fba410e55ed66832, type: 2} + propertyPath: Container + value: + objectReference: {fileID: 1178093757} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: c993e87661906234fba410e55ed66832, type: 2} + m_IsPrefabParent: 0 +--- !u!1 &1012864059 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1012864060} + m_Layer: 0 + m_Name: Level + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1012864060 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1012864059} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 +--- !u!1 &1057734534 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1057734538} + - 223: {fileID: 1057734537} + - 114: {fileID: 1057734536} + - 114: {fileID: 1057734535} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1057734535 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1057734534} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &1057734536 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1057734534} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &1057734537 +Canvas: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1057734534} + m_Enabled: 1 + serializedVersion: 2 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!224 &1057734538 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1057734534} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 534364717} + - {fileID: 1608274018} + m_Father: {fileID: 0} + m_RootOrder: 4 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!1 &1126063559 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1126063561} + - 108: {fileID: 1126063560} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1126063560 +Light: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1126063559} + m_Enabled: 1 + serializedVersion: 6 + m_Type: 1 + m_Color: {r: 1, g: .956862748, b: .839215696, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_Strength: 1 + m_Bias: .0500000007 + m_NormalBias: .400000006 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_BounceIntensity: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 + m_AreaSize: {x: 1, y: 1} +--- !u!4 &1126063561 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1126063559} + m_LocalRotation: {x: .408217937, y: -.234569728, z: .109381676, w: .875426054} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!1 &1178093757 stripped +GameObject: + m_PrefabParentObject: {fileID: 147852, guid: c993e87661906234fba410e55ed66832, type: 2} + m_PrefabInternal: {fileID: 1009381200} +--- !u!1 &1413393085 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1413393086} + - 222: {fileID: 1413393088} + - 114: {fileID: 1413393087} + m_Layer: 5 + m_Name: WatchArea + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1413393086 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1413393085} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2084455285} + - {fileID: 1619281955} + m_Father: {fileID: 1608274018} + m_RootOrder: 3 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: .200000003} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!114 &1413393087 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1413393085} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: .39199999} + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &1413393088 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1413393085} +--- !u!1 &1608274017 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1608274018} + m_Layer: 5 + m_Name: RightUI + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1608274018 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1608274017} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2006180051} + - {fileID: 997683485} + - {fileID: 523974151} + - {fileID: 1413393086} + m_Father: {fileID: 1057734538} + m_RootOrder: 1 + m_AnchorMin: {x: .699999988, y: 0} + m_AnchorMax: {x: 1, y: .899999976} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!1 &1619281954 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1619281955} + m_Layer: 5 + m_Name: Content + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1619281955 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1619281954} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1413393086} + m_RootOrder: 1 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: .850000024} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!1 &1999982083 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1999982087} + - 114: {fileID: 1999982086} + - 114: {fileID: 1999982085} + - 114: {fileID: 1999982084} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1999982084 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1999982083} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1997211142, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_AllowActivationOnStandalone: 0 +--- !u!114 &1999982085 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1999982083} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_AllowActivationOnMobileDevice: 0 +--- !u!114 &1999982086 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1999982083} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 5 +--- !u!4 &1999982087 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1999982083} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 5 +--- !u!1 &2006180048 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 2006180051} + - 222: {fileID: 2006180050} + - 114: {fileID: 2006180049} + m_Layer: 5 + m_Name: RecentPosts + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2006180049 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2006180048} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: .39199999} + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &2006180050 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2006180048} +--- !u!224 &2006180051 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2006180048} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 443951981} + m_Father: {fileID: 1608274018} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: .699999988} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!1001 &2065124246 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 433422, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 433422, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 433422, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 433422, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 433422, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 433422, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 433422, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 433422, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: DetailsPanel + value: + objectReference: {fileID: 724043967} + - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: FriendshipLikeliness + value: .600000024 + objectReference: {fileID: 0} + - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: NumPeople + value: 50 + objectReference: {fileID: 0} + - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: AvgNumFriends + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: gameObjects.PersonObj + value: + objectReference: {fileID: 11417564, guid: 7a5b1db47a2c30e419038df40dffa79a, + type: 2} + - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: gameObjects.LinkObj + value: + objectReference: {fileID: 11495142, guid: fab430cecad80ad4391987a06b550cb7, + type: 2} + - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: levelOptions.AvgNumFriends + value: 6 + objectReference: {fileID: 0} + - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: levelOptions.SphereRadius + value: 7 + objectReference: {fileID: 0} + - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: levelOptions.NumPeople + value: 50 + objectReference: {fileID: 0} + - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: levelOptions.FriendshipLikeliness + value: .600000024 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + m_IsPrefabParent: 0 +--- !u!1 &2084455284 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 2084455285} + - 222: {fileID: 2084455287} + - 114: {fileID: 2084455286} + m_Layer: 5 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2084455285 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2084455284} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1413393086} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: .699999988} + m_AnchorMax: {x: 1, y: .925000012} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -3.05175781e-05, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!114 &2084455286 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2084455284} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1} + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 0 + m_MaxSize: 40 + m_Alignment: 4 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Watchs +--- !u!222 &2084455287 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2084455284} +--- !u!1 &2116360765 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 2116360766} + - 222: {fileID: 2116360768} + - 114: {fileID: 2116360767} + m_Layer: 5 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2116360766 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2116360765} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 997683485} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: .600000024} + m_AnchorMax: {x: 1, y: .899999976} + m_AnchoredPosition: {x: -1.21593475e-05, y: 0} + m_SizeDelta: {x: -3.05180001e-05, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!114 &2116360767 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2116360765} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1} + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 0 + m_MaxSize: 40 + m_Alignment: 4 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Trending +--- !u!222 &2116360768 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2116360765} diff --git a/Assets/Tests/Gameplay_SR.unity.meta b/Assets/Tests/Gameplay_SR.unity.meta new file mode 100644 index 0000000..8b5cb84 --- /dev/null +++ b/Assets/Tests/Gameplay_SR.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 43c96e134d44b1646b218de6f0e4c659 +timeCreated: 1439592514 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Tests/SphereSR.cs b/Assets/Tests/SphereSR.cs deleted file mode 100644 index ca758f2..0000000 --- a/Assets/Tests/SphereSR.cs +++ /dev/null @@ -1,114 +0,0 @@ -using UnityEngine; -using System.Collections; -using System.Collections.Generic; -using DeathBook.Model; - -public class SphereSR : MonoBehaviour -{ - public FriendshipLink LinkObj; - public PersonNode PersonObj; - public int NumPeople = 50; - public int AvgNumFriends = 20; - public float FriendshipLikeliness = 0.4f; - public float SphereRadius = 1f; - public float rotationSpeed = 0.7f; - - public float torqueForce = 50f; - private bool dragging = false; - private Vector3 delta = new Vector3(); - private Rigidbody rb; - - private PersonNode[] peopleNodes; - //TODO private Friendship[] friendships; - private GameObject[] nodes; - - void Awake() - { - LevelGenerator lGen = new LevelGenerator(); - Level lvl = lGen.GenerateLevel(NumPeople, AvgNumFriends, FriendshipLikeliness, SphereRadius); - - InstantiateNodes(lvl); - AssignLinks(lvl); - rb = GetComponent(); - } - - void Update() - { - Vector3 screenMousePos = Input.mousePosition; - - screenMousePos.z = transform.position.z - Camera.main.transform.position.z; - - Vector3 worldMousePos = Camera.main.ScreenToWorldPoint(screenMousePos); - - // If the world position of the mouse is greater than the radius of the sphere, we are outside - if (Mathf.Sqrt(worldMousePos.x * worldMousePos.x + worldMousePos.y * worldMousePos.y) > SphereRadius + 1f) - { - transform.Rotate(Vector3.one * Time.deltaTime * rotationSpeed); - } - - //when right btn clicked, call the chnge rotation - if (Input.GetMouseButtonDown(1)) - { - dragging = true; - } - else if (Input.GetMouseButtonUp(1)) - { - dragging = false; - delta = new Vector3(); - } - - if (dragging) - { - MoveSphere(); - } - } - - void MoveSphere() - { - float deltaX = Input.GetAxis("Mouse X"); - float deltaY = Input.GetAxis("Mouse Y"); - if (deltaX == 0 && deltaY == 0) - { - delta = new Vector3(); - rb.angularVelocity *= 0.8f; - } - delta += new Vector3(deltaX, deltaY, 0); - //rigidbody.AddTorque(); - rb.AddTorque(Vector3.down * delta.x * torqueForce * Time.deltaTime, ForceMode.Impulse); - rb.AddTorque(Vector3.right * delta.y * torqueForce * Time.deltaTime, ForceMode.Impulse); - Debug.Log(delta.x + ", " + delta.y); - - - } - - private void InstantiateNodes(Level lvl) - { - peopleNodes = new PersonNode[lvl.people.Count]; - - int ctr = 0; - foreach (Person p in lvl.people) - { - - PersonNode pInst = Instantiate(PersonObj, p.initialPosition, Quaternion.identity) as PersonNode; - - pInst.transform.parent = this.transform; - - peopleNodes[ctr++] = pInst; - } - } - - private void AssignLinks(Level lvl) - { - foreach (Friendship f in lvl.friendships) - { - FriendshipLink link = Instantiate(LinkObj) as FriendshipLink; - int id1 = f.friend1.id; - int id2 = f.friend2.id; - link.AttachToObjects(peopleNodes[id1].gameObject, peopleNodes[id2].gameObject); - - // Temporary stuff, for testing - peopleNodes[id1].AddLink(link); - peopleNodes[id2].AddLink(link); - } - } -}