Exemplo n.º 1
0
 public Edge(MoveBlockBarrier parent, Vector2 a, Vector2 b)
 {
     Parent        = parent;
     Visible       = true;
     A             = a;
     B             = b;
     Min           = new Vector2(Math.Min(a.X, b.X), Math.Min(a.Y, b.Y));
     Max           = new Vector2(Math.Max(a.X, b.X), Math.Max(a.Y, b.Y));
     Normal        = (b - a).SafeNormalize();
     Perpendicular = -Normal.Perpendicular();
     Length        = (a - b).Length();
 }
Exemplo n.º 2
0
 public void Track(MoveBlockBarrier block)
 {
     list.Add(block);
     if (tiles == null)
     {
         levelTileBounds = (Scene as Level).TileBounds;
         tiles           = new VirtualMap <bool>(levelTileBounds.Width, levelTileBounds.Height, emptyValue: false);
     }
     for (int i = (int)block.X / 8; i < block.Right / 8f; i++)
     {
         for (int j = (int)block.Y / 8; j < block.Bottom / 8f; j++)
         {
             tiles[i - levelTileBounds.X, j - levelTileBounds.Y] = true;
         }
     }
     dirty = true;
 }
Exemplo n.º 3
0
 public void Untrack(MoveBlockBarrier block)
 {
     list.Remove(block);
     if (list.Count <= 0)
     {
         tiles = null;
     }
     else
     {
         for (int i = (int)block.X / 8; i < block.Right / 8f; i++)
         {
             for (int j = (int)block.Y / 8; j < block.Bottom / 8f; j++)
             {
                 tiles[i - levelTileBounds.X, j - levelTileBounds.Y] = false;
             }
         }
     }
     dirty = true;
 }