mirror of
https://github.com/ConjureETS/DeathBook.git
synced 2026-03-24 04:20:58 +00:00
Merge branch 'master' of https://github.com/ConjureETS/DeathBook
This commit is contained in:
commit
70a3593bca
2299
Assets/Prefabs/Canvas.prefab
Normal file
2299
Assets/Prefabs/Canvas.prefab
Normal file
File diff suppressed because it is too large
Load Diff
8
Assets/Prefabs/Canvas.prefab.meta
Normal file
8
Assets/Prefabs/Canvas.prefab.meta
Normal 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
@ -1,13 +1,41 @@
|
||||
using System.Collections.Generic;
|
||||
using DeathBook.Util;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DeathBook.Model
|
||||
{
|
||||
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*/)
|
||||
{
|
||||
//and here...
|
||||
return null;
|
||||
if (LevelManager.Instance.GameLevel.NumDead == LevelManager.Instance.GameLevel.People.Count)
|
||||
{
|
||||
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*/)
|
||||
|
||||
@ -2,20 +2,14 @@
|
||||
|
||||
namespace DeathBook.Model
|
||||
{
|
||||
public class Status
|
||||
public class Status : Post
|
||||
{
|
||||
private int startTime;
|
||||
public int StartTime { get { return startTime; } }
|
||||
private int endTime;
|
||||
public int EndTime { get { return endTime; } }
|
||||
private Friendship friends;
|
||||
public Friendship Friends { get { return friends; } }
|
||||
private string _text;
|
||||
|
||||
public Status(int startTime, Friendship friendship)
|
||||
public string Text
|
||||
{
|
||||
this.startTime = startTime;
|
||||
this.endTime = startTime + (int) Utils.GetRandomValue(700, 250, 3);
|
||||
friends = friendship;
|
||||
get { return _text; }
|
||||
set { _text = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
32
Assets/Scripts/RecentPostsPanel.cs
Normal file
32
Assets/Scripts/RecentPostsPanel.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/Scripts/RecentPostsPanel.cs.meta
Normal file
12
Assets/Scripts/RecentPostsPanel.cs.meta
Normal 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:
|
||||
@ -13,7 +13,7 @@ public class loadLevel : MonoBehaviour
|
||||
|
||||
void NextScene()
|
||||
{
|
||||
Application.LoadLevel("Gameplay");
|
||||
Application.LoadLevel("Tutoriel");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user