Ejemplo n.º 1
0
 /// <summary>
 /// This method, moreover, which adds the object to the field monitors to the object so that the object got its current position in the matrix.
 /// It is necessary for Cell. When we calculate their direction of movement, we work through a list of cells,
 /// instead of through the elements matrix (field of this class). That has to be stored in the object coordinates and change them when moving.
 /// <para></para>
 /// Этот метод, кроме того, что добавляет объект на поле, следит чтоб объект чтоб объект получил свои текущие координаты в матрице.
 /// Это нужно для Cell. Когда мы высчитываем их направление движения, мы работаем через список клеток,
 /// а не через матрицу элементов (речь о полях данного класса). Вот и приходится хранить координаты в самом объекте и менять их при перемещении.
 /// </summary>
 void SetMatrixElement(int x, int y, UniverseObject universeObject)
 {
     universeMatrix[x, y] = universeObject;
     if (universeObject != null)
     {
         universeObject.SetCords(x, y);
     }
 }
Ejemplo n.º 2
0
 void SetMatrixElement(int x, int y, UniverseObject universeObject)
 {
     universeMatrix[x][y] = universeObject;
     universeObject.SetCords(x, y);
 }