This commit is contained in:
RosimInc 2015-08-16 23:43:30 -04:00
commit 70a3593bca
11 changed files with 2503 additions and 1349 deletions

2299
Assets/Prefabs/Canvas.prefab Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5c94559626c169f47a446ce0517b8aec
timeCreated: 1439782683
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,41 @@
using System.Collections.Generic; using DeathBook.Util;
using System.Collections.Generic;
using UnityEngine;
namespace DeathBook.Model namespace DeathBook.Model
{ {
public class PostGenerator public class PostGenerator
{ {
private string[] _posts;
public PostGenerator()
{
TextAsset postsFile = Resources.Load("TextFiles/FacebookPosts") as TextAsset;
_posts = postsFile.text.Split('\n');
}
public Status generateStatus(/*put stuff here*/) public Status generateStatus(/*put stuff here*/)
{ {
//and here... if (LevelManager.Instance.GameLevel.NumDead == LevelManager.Instance.GameLevel.People.Count)
return null; {
return new Status() { Text = "" };
}
Person person = null;
// May be a bottleneck if unlucky, needs to be tested
do
{
person = LevelManager.Instance.GameLevel.People[UnityEngine.Random.Range(0, LevelManager.Instance.GameLevel.People.Count)];
} while (!person.Alive);
Status status = new Status()
{
Text = "<b>" + person.Name + "</b>" + ": " + _posts[UnityEngine.Random.Range(0, _posts.Length)]
};
return status;
} }
public Headline generateHeadline(/*put stuff here*/) public Headline generateHeadline(/*put stuff here*/)

View File

@ -2,20 +2,14 @@
namespace DeathBook.Model namespace DeathBook.Model
{ {
public class Status public class Status : Post
{ {
private int startTime; private string _text;
public int StartTime { get { return startTime; } }
private int endTime;
public int EndTime { get { return endTime; } }
private Friendship friends;
public Friendship Friends { get { return friends; } }
public Status(int startTime, Friendship friendship) public string Text
{ {
this.startTime = startTime; get { return _text; }
this.endTime = startTime + (int) Utils.GetRandomValue(700, 250, 3); set { _text = value; }
friends = friendship; }
}
} }
} }

View File

@ -0,0 +1,32 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using DeathBook.Model;
public class RecentPostsPanel : MonoBehaviour
{
public Text Content;
PostGenerator _postGenerator;
private float _elapsedTime = 0f;
void Start()
{
_postGenerator = new PostGenerator();
}
void Update ()
{
_elapsedTime += Time.deltaTime;
if (_elapsedTime >= 15f)
{
Status status = _postGenerator.generateStatus();
Content.text = status.Text;
_elapsedTime = 0f;
}
}
}

View File

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

View File

@ -13,7 +13,7 @@ public class loadLevel : MonoBehaviour
void NextScene() void NextScene()
{ {
Application.LoadLevel("Gameplay"); Application.LoadLevel("Tutoriel");
} }
} }