mirror of
https://github.com/ConjureETS/DeathBook.git
synced 2026-03-25 13:00:59 +00:00
Did person generation and started friendship generation.
Signed-off-by: RosimInc <rosim_inc@hotmail.com>
This commit is contained in:
parent
95caf44538
commit
626710331a
@ -1,7 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace DeathBook.Model
|
namespace DeathBook.Model
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,12 +1,16 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace DeathBook.Model
|
namespace DeathBook.Model
|
||||||
{
|
{
|
||||||
public class Level
|
public class Level
|
||||||
{
|
{
|
||||||
private int points;
|
private int score;
|
||||||
private Person[] peeps;
|
|
||||||
|
private List<Person> peeps;
|
||||||
|
private List<Friendship> friendships;
|
||||||
|
|
||||||
|
|
||||||
//private Generator gen;
|
//private Generator gen;
|
||||||
private int gameTime;
|
private int gameTime;
|
||||||
private int globalAwareness;
|
private int globalAwareness;
|
||||||
|
|||||||
@ -1,12 +1,76 @@
|
|||||||
using System.Collections.Generic;
|
using UnityEngine;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace DeathBook.Model
|
namespace DeathBook.Model
|
||||||
{
|
{
|
||||||
public class LevelGenerator
|
public class LevelGenerator
|
||||||
{
|
{
|
||||||
public Level generateLevel(/*put stuff here*/)
|
private int numFriends;
|
||||||
|
private int avgConnections;
|
||||||
|
private float radius;
|
||||||
|
|
||||||
|
public Level GenerateLevel()
|
||||||
{
|
{
|
||||||
//and here...
|
//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;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace DeathBook.Model
|
namespace DeathBook.Model
|
||||||
{
|
{
|
||||||
public class Person
|
public class Person
|
||||||
{
|
{
|
||||||
private string name;
|
private string name;
|
||||||
private Friendship[] friendList;
|
private List<Friendship> friendList = new List<Friendship>();
|
||||||
private int friendCount; //lazy
|
public Vector3 initialPosition;
|
||||||
private int timeBetweenPosts; // f = 1/T;
|
private int timeBetweenPosts; // f = 1/T;
|
||||||
private int connectionTime;
|
private int connectionTime;
|
||||||
private int disconnectionTime;
|
private int disconnectionTime;
|
||||||
@ -19,6 +19,10 @@ namespace DeathBook.Model
|
|||||||
|
|
||||||
//private Node node;
|
//private Node node;
|
||||||
|
|
||||||
|
public Person(float x, float y, float z)
|
||||||
|
{
|
||||||
|
initialPosition = new Vector3(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
private bool isConnected(int time)
|
private bool isConnected(int time)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user