public void SetBoardObject(int i, BoardCell elementCell) { if (i >= boardElements.Length) { return; } BoardObject element = elementCell.GetPlacedObject(); if (element == null) { return; } BoardObjectState objectState = new BoardObjectState(); objectState.id = element.GetObjectID(); Vector2Int pos = elementCell.GetPosition(); objectState.x = pos.x; objectState.y = pos.y; objectState.args = element.GetArgs(); objectState.orientation = (int)element.GetDirection(); boardElements[i] = objectState; }