Did person generation and started friendship generation.

Signed-off-by: RosimInc <rosim_inc@hotmail.com>
This commit is contained in:
RosimInc 2015-08-12 19:45:14 -04:00
parent 95caf44538
commit 626710331a
4 changed files with 80 additions and 10 deletions

View File

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DeathBook.Model
{

View File

@ -1,12 +1,16 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace DeathBook.Model
{
public class Level
{
private int points;
private Person[] peeps;
private int score;
private List<Person> peeps;
private List<Friendship> friendships;
//private Generator gen;
private int gameTime;
private int globalAwareness;

View File

@ -1,12 +1,76 @@
using System.Collections.Generic;
using UnityEngine;
using System.Collections.Generic;
namespace DeathBook.Model
{
public class LevelGenerator
{
public Level generateLevel(/*put stuff here*/)
private int numFriends;
private int avgConnections;
private float radius;
public Level GenerateLevel()
{
//and here...
List<Person> people = CreatePeople();
List<Friendship> friendships = CreateFriendships(people);
return null;
}
private List<Person> CreatePeople()
{
List<Person> people = new List<Person>(numFriends);
float dlong = Mathf.PI * (3 - Mathf.Sqrt(5)); //~2.39996323
float dz = (2f / numFriends) * radius;
float longitude = 0f;
float z = radius - dz / 2;
float r, x, y;
Person p;
for (int i = 0; i < numFriends; i++)
{
r = Mathf.Sqrt(radius * radius - z * z);
x = Mathf.Cos(longitude) * r;
y = Mathf.Sin(longitude) * r;
p = new Person(x,y,z);
people.Add(p);
z -= dz;
longitude += dlong;
}
return people;
}
private List<Friendship> CreateFriendships(List<Person> people)
{
List<Friendship> friendships = new List<Friendship>();
float rSq = radius * radius;
for (int i = 0, count = people.Count; i < count; i++)
{
for (int j = i+1; j < count; j++)
{
// Nombre d'amis présents
//
}
}
//TODO
return null;
}
}

View File

@ -1,13 +1,13 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace DeathBook.Model
{
public class Person
{
private string name;
private Friendship[] friendList;
private int friendCount; //lazy
private List<Friendship> friendList = new List<Friendship>();
public Vector3 initialPosition;
private int timeBetweenPosts; // f = 1/T;
private int connectionTime;
private int disconnectionTime;
@ -19,6 +19,10 @@ namespace DeathBook.Model
//private Node node;
public Person(float x, float y, float z)
{
initialPosition = new Vector3(x, y, z);
}
private bool isConnected(int time)
{