diff --git a/Assets/Scripts/Models/Level.cs b/Assets/Scripts/Models/Level.cs index 4785806..4c81f7f 100644 --- a/Assets/Scripts/Models/Level.cs +++ b/Assets/Scripts/Models/Level.cs @@ -27,6 +27,7 @@ namespace DeathBook.Model private float globalAwareness; //on a scale from 0 to 1 public float GlobalAwareness { get { return globalAwareness; } } public int tutorialInt = 0; + public bool allowNext = true; private GameStrategy strategy = null; public GameStrategy Strategy { get { return strategy; } } diff --git a/Assets/Scripts/Models/Person.cs b/Assets/Scripts/Models/Person.cs index 9c54c27..aef10cc 100644 --- a/Assets/Scripts/Models/Person.cs +++ b/Assets/Scripts/Models/Person.cs @@ -104,11 +104,15 @@ namespace DeathBook.Model public bool Kill() { - if (Online) - return false; + if (Online || (LevelManager.Instance.GameLevel.tutorialInt < 4)) + return false; //Debug.Log("Person " + id + " died!"); alive = false; + + if (LevelManager.Instance.GameLevel.tutorialInt == 4) + LevelManager.Instance.GameLevel.allowNext = true; + foreach (Friendship f in friendsList) f.Other.NotifyFriendWasKilled(); NotifyObservers(); diff --git a/Assets/Scripts/NetworkingSphere.cs b/Assets/Scripts/NetworkingSphere.cs index 19b04e0..75203e0 100644 --- a/Assets/Scripts/NetworkingSphere.cs +++ b/Assets/Scripts/NetworkingSphere.cs @@ -42,21 +42,22 @@ public class NetworkingSphere : MonoBehaviour private PersonNode _selectedNode; private float _timeSinceLastClick; + private Level lvl; + // Used to disable the physics when the user has clicked on a node private bool _isRotatingTowardsNode = false; void Awake() { manager = LevelManager.Instance; - Level lvl = manager.NewLevel(levelOptions.NumPeople, levelOptions.AvgNumFriends, levelOptions.FriendshipLikeliness, levelOptions.SphereRadius, strategy); - + lvl = manager.NewLevel(levelOptions.NumPeople, levelOptions.AvgNumFriends, levelOptions.FriendshipLikeliness, levelOptions.SphereRadius, strategy); InstantiateNodes(lvl); AssignLinks(lvl); rb = GetComponent(); } void OnGUI() - { + { int time = manager.GameLevel.DayTime; GUI.Button(new Rect(50, 50, 100, 40), Utils.GetTimeString(time)); GUI.Button(new Rect(160, 50, 100, 40), manager.GameLevel.Awareness + ""); @@ -97,8 +98,12 @@ public class NetworkingSphere : MonoBehaviour delta = new Vector3(); } - if ((dragging && !_isRotatingTowardsNode)) // && ((lvl.tutorialCount == 0) || (lvl.tutorialCount == 1)) + if ((dragging && !_isRotatingTowardsNode)) { + if (lvl.tutorialInt == 1) + { + lvl.allowNext = true; + } MoveSphere(); } @@ -150,6 +155,9 @@ public class NetworkingSphere : MonoBehaviour private void OnNodeClicked(PersonNode node) { + if (lvl.tutorialInt == 2) + lvl.allowNext = true; + rb.angularVelocity = Vector3.zero; if (_selectedNode != null) @@ -159,7 +167,8 @@ public class NetworkingSphere : MonoBehaviour if (!_isRotatingTowardsNode || node != _selectedNode) { - FocusOnNode(node); + if (lvl.tutorialInt > 1) + FocusOnNode(node); } @@ -196,6 +205,7 @@ public class NetworkingSphere : MonoBehaviour public void FocusOnNode(PersonNode node) { + StopCoroutine("RotateTowardsNodeCoroutine"); StartCoroutine("RotateTowardsNodeCoroutine", node); diff --git a/Assets/Scripts/TutorialScript.cs b/Assets/Scripts/TutorialScript.cs index 6b28817..6d5b2b7 100644 --- a/Assets/Scripts/TutorialScript.cs +++ b/Assets/Scripts/TutorialScript.cs @@ -5,14 +5,12 @@ using DeathBook.Model; public class TutorialScript : MonoBehaviour { - //public int tutorialInt = 0; public GameObject panel; public Text tutorialText; public Button btnNext; private Level lvl; - // Use this for initialization void Start() { lvl = LevelManager.Instance.GameLevel; @@ -20,13 +18,17 @@ public class TutorialScript : MonoBehaviour { void Update() { + + btnNext.enabled = lvl.allowNext; + + + if (lvl.tutorialInt == 0) { Time.timeScale = 0; - tutorialText.text = "The facebook servers are full!\nMark Zuckerberg hired you, Death, to kill off a few of his users.\nCareful, or you might scare them away from Mark's website..."; - //btnNext.onClick - + lvl.allowNext = true; + tutorialText.text = "The facebook servers are full!\nMark Zuckerberg hired you, Death, to kill off a few of his users.\n\nCareful, or you might scare them away from Mark's website..."; } else if (lvl.tutorialInt == 1) { @@ -34,7 +36,7 @@ public class TutorialScript : MonoBehaviour { } else if (lvl.tutorialInt == 2) { - tutorialText.text = "Move around by clicking on the users in the network!"; + tutorialText.text = "Move around by left clicking on the users in the network!"; } else if (lvl.tutorialInt == 3) { @@ -42,7 +44,13 @@ public class TutorialScript : MonoBehaviour { } else if (lvl.tutorialInt == 4) { - tutorialText.text = "Alright, time for our first victim.\nHold the right mouse button over a user until the X appears completely."; + tutorialText.text = "Alright, time for our first victim.\nHold the LEFT mouse button over a user until the X is complete.\nBeware! The user must be offline to be killed!"; + tutorialText.text += "\n\nYou can hold the mouse button until the user goes offline."; + } + else if (lvl.tutorialInt == 5) + { + tutorialText.text = "Kill many users to see how the color changes\n\nRemember, as users realize something is wrong with facebook,\nthe entire network will turn red!\n\nHaveFun!"; + lvl.allowNext = true; } else { @@ -54,10 +62,12 @@ public class TutorialScript : MonoBehaviour { public void btnClick() { + lvl.tutorialInt++; - Debug.Log(lvl.tutorialInt + ", aasfasf"); + //Debug.Log(lvl.tutorialInt + ", aasfasf"); Time.timeScale = 1; tutorialText.text = "eee"; + lvl.allowNext = false; //panel.transform.Translate(Vector3.right * 100); } diff --git a/Assets/Scripts/UIFriendPicture.cs b/Assets/Scripts/UIFriendPicture.cs index 425cfdd..e633176 100644 --- a/Assets/Scripts/UIFriendPicture.cs +++ b/Assets/Scripts/UIFriendPicture.cs @@ -7,6 +7,7 @@ using UnityEngine.UI; public class UIFriendPicture : MonoBehaviour { private Person _model; + private Level lvl; public Person Model { @@ -23,11 +24,14 @@ public class UIFriendPicture : MonoBehaviour void Awake() { + lvl = LevelManager.Instance.GameLevel; _picture = GetComponent(); } public void OnClick() { + if (lvl.tutorialInt == 3) + lvl.allowNext = true; _model.SelectNode(); _model.SelectNode(); }