public Application( IGameState gameState, IVisuals visuals, INavigation navigation) { _gameState = gameState ?? throw new ArgumentNullException(nameof(gameState)); _visuals = visuals ?? throw new ArgumentNullException(nameof(visuals)); _navigation = navigation ?? throw new ArgumentNullException(nameof(navigation)); }
/// <remarks>A standard if else is used here instead of the ternary conditional operator to prevent an implicit conversion error in the 2020 editor.</remarks> public void Init(IEditorGameService editorGameService) { if (editorGameService.Enabler.IsEnabled()) { m_CurrentVisuals = new EnabledVisuals(); } else { m_CurrentVisuals = new DisabledVisuals(); } }
GameObject GenerateObject(GameObject prefab, bool canRotate) { Quaternion rotation = prefab.transform.rotation; if (canRotate) { rotation = Quaternion.Euler(0, Random.Range(0, 360), 0); } GameObject spawnedObject = Object.Instantiate(prefab); IVisuals placeable = spawnedObject.GetComponent <IVisuals>(); AddToDictionary(prefab.name); return(spawnedObject); }
public void GenerateObjects(int seed) { Random.InitState(seed); foreach (MapVisualsSpecification spec in specs) { int amountOfType = Random.Range(spec.minAmount, spec.maxAmount + 1); for (int i = 0; i < amountOfType; i++) { GameObject placeableObject = GenerateObject(GetRandomObject(spec.type, amountOfType), spec.canRotate); IVisuals placeable = placeableObject.GetComponent <IVisuals>(); PlaceObject(placeableObject, GetRandomMultiTile(placeable.currentPosition.size, spec)); } } }