public void OnRandom() { StageLevelInfo level = EditorMenuManager.instance.GetCurrentLevel(); if (level != null) { EditorMenuManager.instance.AssignEntitiesRandomly(); OnShowEditMenu(false); } }
public bool CopyFrom(StageLevelInfo lv) { if (lv != null) { usedEntities = lv.usedEntities; rowSize = lv.rowSize; if (rowSize <= 0) { rowSize = GameDatabase.instance.playBoardRow; } colSize = lv.colSize; if (colSize <= 0) { colSize = GameDatabase.instance.playBoardCol; } if (rowSize > 0 && colSize > 0) { //int size = width*height; if (lv.squares != null && lv.squares.Length > 0 && lv.entities != null && lv.entities.Length > 0) { squares = new UInt16[rowSize, colSize]; if (lv.squares.Length == rowSize * colSize) { for (int r = 0; r < rowSize; r++) { for (int c = 0; c < colSize; c++) { squares[r, c] = lv.squares[r, c]; } } } entities = new UInt16[rowSize, colSize]; if (lv.entities.Length == rowSize * colSize) { for (int r = 0; r < rowSize; r++) { for (int c = 0; c < colSize; c++) { entities[r, c] = lv.entities[r, c]; } } } return(true); } } } return(false); }
void InitUsedEntityList(StageLevelInfo level) { UInt16 compare = 0x0001; int max = GameDatabase.instance.defaultEntities.Length; if (max > 16) { max = 16; } usedEntityIndexes.Clear(); for (UInt16 i = 1; i <= max; i++) { if ((level.usedEntities & compare) > 0) { usedEntityIndexes.Add(i); } compare <<= 1; } }