This commit is contained in:
Patrice Vignola 2015-08-16 20:44:47 -04:00
commit 4ff2acabe9
15 changed files with 1923 additions and 147 deletions

View File

@ -96,6 +96,23 @@ MonoBehaviour:
AvgNumFriends: 8
FriendshipLikeliness: .600000024
SphereRadius: 7
strategy:
awarenessChange:
friendRatio: {x: .200000003, y: .800000012, z: 1.5}
lastDeath: {x: .600000024, y: .400000006, z: 1}
maxDeathDuration: 10080
modifier: .219999999
deathNoticing:
popularity: {x: .600000024, y: .400000006, z: 1}
importance: {x: .75, y: .25, z: 1}
numFriends: {x: .800000012, y: .200000003, z: 1}
awareness: {x: .800000012, y: .200000003, z: 1}
modifier: .0299999993
chanceToPost:
popularity: {x: .699999988, y: .300000012, z: 1}
importance: {x: .699999988, y: .300000012, z: 1}
frequency: {x: .699999988, y: .300000012, z: 1}
modifier: .100000001
rotationSpeed: .699999988
torqueForce: 1
DetailsPanel: {fileID: 0}

View File

@ -1512,126 +1512,6 @@ Prefab:
propertyPath: DetailsPanel
value:
objectReference: {fileID: 1197925315}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.awarenessChange.friendRatio.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.awarenessChange.friendRatio.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.awarenessChange.friendRatio.z
value: .200000003
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.awarenessChange.lastDeath.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.deathNoticing.popularity.x
value: .100000001
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.deathNoticing.importance.x
value: .100000001
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.deathNoticing.numFriends.x
value: .100000001
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.deathNoticing.awareness.x
value: .100000001
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.chanceToPost.popularity.x
value: .100000001
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.chanceToPost.importance.x
value: .100000001
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.chanceToPost.frequency.x
value: .100000001
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.awarenessChange.lastDeath.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.deathNoticing.popularity.y
value: .899999976
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.deathNoticing.importance.y
value: .899999976
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.deathNoticing.numFriends.y
value: .899999976
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.deathNoticing.awareness.y
value: .899999976
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.chanceToPost.popularity.y
value: .899999976
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.chanceToPost.importance.y
value: .899999976
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.chanceToPost.frequency.y
value: .899999976
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.awarenessChange.lastDeath.z
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.deathNoticing.popularity.z
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.deathNoticing.importance.z
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.deathNoticing.numFriends.z
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.deathNoticing.awareness.z
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.chanceToPost.popularity.z
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.chanceToPost.importance.z
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2}
propertyPath: strategy.chanceToPost.frequency.z
value: 1
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.AvgNumFriends
value: 8
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

1671
Assets/Scenes/Tutoriel.unity Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 954690b6e2639f149bb1741d688d2815
timeCreated: 1439747828
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -195,8 +195,8 @@ Camera:
m_GameObject: {fileID: 608195445}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438}
m_ClearFlags: 2
m_BackGroundColor: {r: 0, g: 0, b: 0, a: .0196078438}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
@ -317,6 +317,7 @@ GameObject:
- 33: {fileID: 1865312315}
- 64: {fileID: 1865312314}
- 23: {fileID: 1865312313}
- 114: {fileID: 1865312317}
m_Layer: 0
m_Name: Background
m_TagString: Untagged
@ -379,3 +380,15 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
--- !u!114 &1865312317
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1865312312}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2931322f1f0c62f40b2d7a6e493934ca, type: 3}
m_Name:
m_EditorClassIdentifier:
timeToWait: 2

View File

@ -14,6 +14,7 @@ namespace DeathBook.Model
public Vector3 friendRatio = new Vector3();
public Vector3 lastDeath = new Vector3();
public float maxDeathDuration = 24 * 60 * 7;
public float modifier = 0.1f;
}
[System.Serializable]
@ -23,6 +24,7 @@ namespace DeathBook.Model
public Vector3 importance = new Vector3();
public Vector3 numFriends = new Vector3();
public Vector3 awareness = new Vector3();
public float modifier = 0.1f;
}
[System.Serializable]
@ -31,6 +33,7 @@ namespace DeathBook.Model
public Vector3 popularity = new Vector3();
public Vector3 importance = new Vector3();
public Vector3 frequency = new Vector3();
public float modifier = 0.1f;
}
@ -40,14 +43,14 @@ namespace DeathBook.Model
public float GetAwarenessChange(int numDeadFriends, int numAliveFriends, int sinceLastDeath)
{
float friendsRatioInd = numAliveFriends == 0 ? 1 : GetValue(Mathf.Min(numDeadFriends / numAliveFriends, 1), awarenessChange.friendRatio);
float friendsRatioInd = numAliveFriends == 0 ? 1 : GetValue(Mathf.Min(numDeadFriends * 1f / numAliveFriends, 1f), awarenessChange.friendRatio);
float max = awarenessChange.maxDeathDuration;
float lastDeathInd = GetValue(1 - Mathf.Min(sinceLastDeath, max) / max, awarenessChange.lastDeath);
//Debug.Log(lastDeathInd + " " + friendsRatioInd);
Debug.Log(friendsRatioInd + " -- " + lastDeathInd);
return Mathf.Clamp(friendsRatioInd * lastDeathInd, 0, 1);
return Mathf.Clamp(friendsRatioInd * lastDeathInd, 0, 1) * awarenessChange.modifier;
}
public float GetDeathNoticing(float friendPopularity, float friendshipImportance, int numAliveFriends, float awareness)
@ -56,12 +59,11 @@ namespace DeathBook.Model
float importanceInd = GetValue(friendshipImportance, deathNoticing.importance);
//TODO Should be inverse and there should be an expected number of friends
float aliveFriendsInd = GetValue(numAliveFriends, deathNoticing.numFriends);
float aliveFriendsInd = GetValue(Mathf.Min(numAliveFriends * 0.1f, 1), deathNoticing.numFriends);
float awarenessInd = GetValue(awareness, deathNoticing.awareness);
return Mathf.Clamp(popularityInd * importanceInd * aliveFriendsInd * awarenessInd, 0, 1);
return Mathf.Clamp(popularityInd * importanceInd * aliveFriendsInd * awarenessInd, 0, 1) * deathNoticing.modifier;
}
public float GetChanceToPost(float friendPopularity, float friendshipImportance)
@ -70,7 +72,7 @@ namespace DeathBook.Model
float importanceInd = GetValue(1 - friendshipImportance, deathNoticing.importance);
return Mathf.Clamp(popularityInd * importanceInd, 0, 1);
return Mathf.Clamp(popularityInd * importanceInd, 0, 1) * chanceToPost.modifier;
}
public float GetChanceToRead()

View File

@ -26,6 +26,8 @@ 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; } }

View File

@ -104,11 +104,15 @@ namespace DeathBook.Model
public bool Kill()
{
if (Online)
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();

View File

@ -42,14 +42,15 @@ 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<Rigidbody>();
@ -97,8 +98,12 @@ public class NetworkingSphere : MonoBehaviour
delta = new Vector3();
}
if (dragging && !_isRotatingTowardsNode)
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,6 +167,7 @@ public class NetworkingSphere : MonoBehaviour
if (!_isRotatingTowardsNode || node != _selectedNode)
{
if (lvl.tutorialInt > 1)
FocusOnNode(node);
}
@ -196,6 +205,7 @@ public class NetworkingSphere : MonoBehaviour
public void FocusOnNode(PersonNode node)
{
StopCoroutine("RotateTowardsNodeCoroutine");
StartCoroutine("RotateTowardsNodeCoroutine", node);

View File

@ -0,0 +1,74 @@
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using DeathBook.Model;
public class TutorialScript : MonoBehaviour {
public GameObject panel;
public Text tutorialText;
public Button btnNext;
private Level lvl;
void Start()
{
lvl = LevelManager.Instance.GameLevel;
}
void Update() {
btnNext.enabled = lvl.allowNext;
if (lvl.tutorialInt == 0)
{
Time.timeScale = 0;
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)
{
tutorialText.text = "See how navigating works by holding the right mouse button and moving the sphere.\n\nThen, hit Next!";
}
else if (lvl.tutorialInt == 2)
{
tutorialText.text = "Move around by left clicking on the users in the network!";
}
else if (lvl.tutorialInt == 3)
{
tutorialText.text = "Let's see what happens when you click on a user's friend list.";
}
else if (lvl.tutorialInt == 4)
{
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
{
panel.SetActive(false);
}
}
public void btnClick()
{
lvl.tutorialInt++;
//Debug.Log(lvl.tutorialInt + ", aasfasf");
Time.timeScale = 1;
tutorialText.text = "eee";
lvl.allowNext = false;
//panel.transform.Translate(Vector3.right * 100);
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c42f0ece4454ca044b3152cc78312428
timeCreated: 1439753311
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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<Image>();
}
public void OnClick()
{
if (lvl.tutorialInt == 3)
lvl.allowNext = true;
_model.SelectNode();
_model.SelectNode();
}

65
Assets/Tests/RulesTest.cs Normal file
View File

@ -0,0 +1,65 @@
using UnityEngine;
using System.Collections;
using DeathBook.Model;
public class RulesTest : MonoBehaviour {
public GameStrategy strategy = new GameStrategy();
public ChangeAwarenessTest awareness = new ChangeAwarenessTest();
public NoticeDeathTest noticeDeath = new NoticeDeathTest();
public static GameStrategy str = null;
[System.Serializable]
public class ChangeAwarenessTest
{
public int numDeadFriends;
public int numAliveFriends;
public int sinceLastDeath;
public bool test = false;
public float result = 0f;
public void Update()
{
if (!test)
return;
test = false;
result = RulesTest.str.GetAwarenessChange(numDeadFriends, numAliveFriends, sinceLastDeath);
}
}
[System.Serializable]
public class NoticeDeathTest
{
public float popularity;
public float importance;
public int numAliveFriends;
public float awareness;
public bool test = false;
public float result = 0f;
public void Update()
{
if (!test)
return;
test = false;
result = RulesTest.str.GetDeathNoticing(popularity, importance, numAliveFriends, awareness);
}
}
// Use this for initialization
void Start () {
str = strategy;
}
// Update is called once per frame
void Update () {
awareness.Update();
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: debe9fb44675c3e49ba7e4c511a91076
timeCreated: 1439754262
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -7,3 +7,5 @@ EditorBuildSettings:
m_Scenes:
- enabled: 1
path: Assets/Scenes/Gameplay.unity
- enabled: 1
path: Assets/Scenes/splash.unity