Esempio n. 1
0
    public override void Paint(Seat seat)
    {
        Bounds bounds = AreaBoardManager.Instance.GetBounds ();

        System.Random random = new System.Random();
        float px = (float)random.NextDouble () * bounds.size.x;
        float py = (float)random.NextDouble () * bounds.size.y;
        float nx = px - bounds.center.x - bounds.size.x/2;
        float ny = py - bounds.center.y - bounds.size.y/2;

        Vector2 newPosition = new Vector2(nx, ny);
        seat.AddCircle (new Circle(newPosition, radius));
    }
Esempio n. 2
0
    private void PaintLine(Seat seat, Vector2 from, Vector2 to)
    {
        float distance = Vector2.Distance (from, to);

        // FIXME: avoid div 0.
        if (distance <= 0) {
            distance = 0.001f;
        }

        int step = (int)((distance/ radius) * 2.0f + 1);
        float stepX = (to.x - from.x) / step;
        float stepY = (to.y - from.y) / step;

        for (int i = 0; i<step; i++) {
            Vector2 newPosition = new Vector2(from.x + stepX * i, from.y + stepY * i);
            seat.AddCircle (new Circle(newPosition, radius));
        }
    }
Esempio n. 3
0
 public override void Paint(Seat seat)
 {
     seat.AddCircle (new Circle(position, radius));
 }