public void Move(Point p) { Control c = room.Display.GetControlFromPosition(position.X, position.Y); if (c != null) { room.Display.Controls.Remove(c); Control cp = room.Display.GetControlFromPosition(p.X, p.Y); if (cp != null) { room.Display.Controls.Remove(cp); cp.Dispose(); } room.Display.Controls.Add(c, p.X, p.Y); } room.UpdateRoomObject(position, Below); Below = room.Map[p.X, p.Y]; room.UpdateRoomObject(p, this); }
public RoomObject(Point p, RoomEnvironment r, bool i = false) { position = p; room = r; color = RoomObject.objcolor; type = RoomObject.objtype; UpdateMovableState(i); if (room.Map != null) { Below = room.Map[p.X, p.Y]; room.UpdateRoomObject(p, this); if (Below != null && (Below.type == Process.SetAgent || Below.type == Process.SetObstacles)) { Below = null; } } }