public World() { m_triangles = new List<Triangle>(); m_walls = new List<Segment>(); m_intersections = new List<Point>(); m_renderer = new TriangleRenderer(); m_SRenderer = new SegmentRenderer(); m_players = new List<Player>(); m_camera = new Camera(); //Creation des joueurs m_player = new Player(); m_camera.Bounds = new Box2(0, 0, 1000, 1000); m_camera.Target = m_player; Player.SetPosition(new Vector2(200, 200)); m_random = new Random(); //for (var i = 0; i < 20; i++) //{ // var x = m_random.Next(0, 500); // var y = m_random.Next(0, 500); // var p = new Player(); // p.SetPosition(new Vector2(x, y)); // m_players.Add(p); //} var p = new Player(); p.SetPosition(new Vector2(400, 100)); p.SetPositionNext(new Vector2(400, 400)); m_players.Add(p); for (var i = 0; i < 10; i++) { var x = m_random.Next(0, 500); var y = m_random.Next(0, 500); var sx = m_random.Next(10, 50); var sy = m_random.Next(10, 50); m_walls.Add(new Segment() { P1 = new Vector2(x, y), P2 = new Vector2(x + sx, y), Color = new Vector4(0.5f, 0.2f, 0, 1) }); m_walls.Add(new Segment() { P1 = new Vector2(x + sx, y), P2 = new Vector2(x + sx, y + sy), Color = new Vector4(0.5f, 0.2f, 0, 1) }); m_walls.Add(new Segment() { P1 = new Vector2(x + sx, y + sy), P2 = new Vector2(x, y + sy), Color = new Vector4(0.5f, 0.2f, 0, 1) }); m_walls.Add(new Segment() { P1 = new Vector2(x, y + sy), P2 = new Vector2(x, y), Color = new Vector4(0.5f, 0.2f, 0, 1) }); } //m_walls.Add(new Segment() //{ // P1 = new Vector3(300, 300, 0), // P2 = new Vector3(300, 400, 0), // Color = new Vector4(0.5f, 0.2f, 0, 1) //}); //m_walls.Add(new Segment() //{ // P1 = new Vector3(300, 400, 0), // P2 = new Vector3(400, 400, 0), // Color = new Vector4(0.5f, 0.2f, 0, 1) //}); //m_walls.Add(new Segment() //{ // P1 = new Vector3(400, 400, 0), // P2 = new Vector3(400, 300, 0), // Color = new Vector4(0.5f, 0.2f, 0, 1) //}); //m_walls.Add(new Segment() //{ // P1 = new Vector3(400, 300, 0), // P2 = new Vector3(300, 300, 0), // Color = new Vector4(0.5f, 0.2f, 0, 1) //}); s_instance = this; //Triangles(); m_time = Time.Instance; m_time.AddAction(new Granite.Time.Action(Update, 0.1)); //m_time.AddAction(new Granite.Time.Action(UpdatePlayers, 2)); m_time.Start(); }
public void SetParent(Time parent) { m_parent = parent; }