public void Init(int flow, int level) { fieldMap.Init(levelProvider.GetMapData(flow, level)); int sx = fieldMap.HorizontalLength; int sy = fieldMap.VerticalLength; finish.Init(new Vector2(sx, sy) * Field.SIZE, fieldMap.ShowInterval, fieldMap.HideInterval); player.Init(Vector2.zero, fieldMap.ShowInterval, fieldMap.HideInterval); playerActualPosition = player.transform.position; queuedFields.Clear(); queuedMoves.Clear(); InitCenter(); state = StateEnum.Idle; fieldMap.ShowPreview(); showActors(); if (OnLevelStarted != null) { OnLevelStarted(); } }
public void Init(MapData mapData) { this.mapData = mapData; part = 0; offset = new Vector2(mapData.Offset.X, mapData.Offset.Y); fieldMap.Init(levelProvider.GetMapData(mapData), offset); InitPlayerPosition(part); InitFinishPosition(part); queuedFields.Clear(); queuedMoves.Clear(); InitCenter(); state = StateEnum.Idle; fieldMap.ShowPreview(); ShowActors(); if (OnLevelStarted != null) { OnLevelStarted(); } }