tutorial completed

This commit is contained in:
unknown 2015-08-16 19:12:46 -04:00
parent 91faee41f2
commit 0adaf2487c
5 changed files with 44 additions and 15 deletions

View File

@ -27,6 +27,7 @@ namespace DeathBook.Model
private float globalAwareness; //on a scale from 0 to 1 private float globalAwareness; //on a scale from 0 to 1
public float GlobalAwareness { get { return globalAwareness; } } public float GlobalAwareness { get { return globalAwareness; } }
public int tutorialInt = 0; public int tutorialInt = 0;
public bool allowNext = true;
private GameStrategy strategy = null; private GameStrategy strategy = null;
public GameStrategy Strategy { get { return strategy; } } public GameStrategy Strategy { get { return strategy; } }

View File

@ -104,11 +104,15 @@ namespace DeathBook.Model
public bool Kill() public bool Kill()
{ {
if (Online) if (Online || (LevelManager.Instance.GameLevel.tutorialInt < 4))
return false; return false;
//Debug.Log("Person " + id + " died!"); //Debug.Log("Person " + id + " died!");
alive = false; alive = false;
if (LevelManager.Instance.GameLevel.tutorialInt == 4)
LevelManager.Instance.GameLevel.allowNext = true;
foreach (Friendship f in friendsList) foreach (Friendship f in friendsList)
f.Other.NotifyFriendWasKilled(); f.Other.NotifyFriendWasKilled();
NotifyObservers(); NotifyObservers();

View File

@ -42,21 +42,22 @@ public class NetworkingSphere : MonoBehaviour
private PersonNode _selectedNode; private PersonNode _selectedNode;
private float _timeSinceLastClick; private float _timeSinceLastClick;
private Level lvl;
// Used to disable the physics when the user has clicked on a node // Used to disable the physics when the user has clicked on a node
private bool _isRotatingTowardsNode = false; private bool _isRotatingTowardsNode = false;
void Awake() void Awake()
{ {
manager = LevelManager.Instance; 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); InstantiateNodes(lvl);
AssignLinks(lvl); AssignLinks(lvl);
rb = GetComponent<Rigidbody>(); rb = GetComponent<Rigidbody>();
} }
void OnGUI() void OnGUI()
{ {
int time = manager.GameLevel.DayTime; int time = manager.GameLevel.DayTime;
GUI.Button(new Rect(50, 50, 100, 40), Utils.GetTimeString(time)); GUI.Button(new Rect(50, 50, 100, 40), Utils.GetTimeString(time));
GUI.Button(new Rect(160, 50, 100, 40), manager.GameLevel.Awareness + ""); GUI.Button(new Rect(160, 50, 100, 40), manager.GameLevel.Awareness + "");
@ -97,8 +98,12 @@ public class NetworkingSphere : MonoBehaviour
delta = new Vector3(); delta = new Vector3();
} }
if ((dragging && !_isRotatingTowardsNode)) // && ((lvl.tutorialCount == 0) || (lvl.tutorialCount == 1)) if ((dragging && !_isRotatingTowardsNode))
{ {
if (lvl.tutorialInt == 1)
{
lvl.allowNext = true;
}
MoveSphere(); MoveSphere();
} }
@ -150,6 +155,9 @@ public class NetworkingSphere : MonoBehaviour
private void OnNodeClicked(PersonNode node) private void OnNodeClicked(PersonNode node)
{ {
if (lvl.tutorialInt == 2)
lvl.allowNext = true;
rb.angularVelocity = Vector3.zero; rb.angularVelocity = Vector3.zero;
if (_selectedNode != null) if (_selectedNode != null)
@ -159,7 +167,8 @@ public class NetworkingSphere : MonoBehaviour
if (!_isRotatingTowardsNode || node != _selectedNode) 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) public void FocusOnNode(PersonNode node)
{ {
StopCoroutine("RotateTowardsNodeCoroutine"); StopCoroutine("RotateTowardsNodeCoroutine");
StartCoroutine("RotateTowardsNodeCoroutine", node); StartCoroutine("RotateTowardsNodeCoroutine", node);

View File

@ -5,14 +5,12 @@ using DeathBook.Model;
public class TutorialScript : MonoBehaviour { public class TutorialScript : MonoBehaviour {
//public int tutorialInt = 0;
public GameObject panel; public GameObject panel;
public Text tutorialText; public Text tutorialText;
public Button btnNext; public Button btnNext;
private Level lvl; private Level lvl;
// Use this for initialization
void Start() void Start()
{ {
lvl = LevelManager.Instance.GameLevel; lvl = LevelManager.Instance.GameLevel;
@ -21,12 +19,16 @@ public class TutorialScript : MonoBehaviour {
void Update() { void Update() {
btnNext.enabled = lvl.allowNext;
if (lvl.tutorialInt == 0) if (lvl.tutorialInt == 0)
{ {
Time.timeScale = 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..."; lvl.allowNext = true;
//btnNext.onClick 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) else if (lvl.tutorialInt == 1)
{ {
@ -34,7 +36,7 @@ public class TutorialScript : MonoBehaviour {
} }
else if (lvl.tutorialInt == 2) 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) else if (lvl.tutorialInt == 3)
{ {
@ -42,7 +44,13 @@ public class TutorialScript : MonoBehaviour {
} }
else if (lvl.tutorialInt == 4) 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 else
{ {
@ -54,10 +62,12 @@ public class TutorialScript : MonoBehaviour {
public void btnClick() public void btnClick()
{ {
lvl.tutorialInt++; lvl.tutorialInt++;
Debug.Log(lvl.tutorialInt + ", aasfasf"); //Debug.Log(lvl.tutorialInt + ", aasfasf");
Time.timeScale = 1; Time.timeScale = 1;
tutorialText.text = "eee"; tutorialText.text = "eee";
lvl.allowNext = false;
//panel.transform.Translate(Vector3.right * 100); //panel.transform.Translate(Vector3.right * 100);
} }

View File

@ -7,6 +7,7 @@ using UnityEngine.UI;
public class UIFriendPicture : MonoBehaviour public class UIFriendPicture : MonoBehaviour
{ {
private Person _model; private Person _model;
private Level lvl;
public Person Model public Person Model
{ {
@ -23,11 +24,14 @@ public class UIFriendPicture : MonoBehaviour
void Awake() void Awake()
{ {
lvl = LevelManager.Instance.GameLevel;
_picture = GetComponent<Image>(); _picture = GetComponent<Image>();
} }
public void OnClick() public void OnClick()
{ {
if (lvl.tutorialInt == 3)
lvl.allowNext = true;
_model.SelectNode(); _model.SelectNode();
_model.SelectNode(); _model.SelectNode();
} }