private void OnTriggerStay2D(Collider2D collision) { if ((collision.CompareTag("Player")) && (Input.GetButtonDown("Interact"))) { ShipGenerator.Generate(collision.transform, backgroundPrefab, alienPrefab, holderPrefab, platformPrefab, blockPrefab, pointPrefab, sizeX, sizeY, incrementX, incrementY, threshold, enemySpawnRate, exitSpawnRate); } }
private List <KeyValuePair <string, int> > SimulateShipsOnBoard() { var markedCoordGroup = new Dictionary <string, int>(); var ships = new List <Ship>(); foreach (var index in Enumerable.Range(1, NumberOfSimulations)) { ships.AddRange(_shipGenerator.Generate().ToList()); } var keys = ships .SelectMany(s => s.Coordinates) .Select(s => s.Key) .ToList(); foreach (var key in keys) { if (markedCoordGroup.TryGetValue(key, out var count)) { markedCoordGroup[key] = ++count; continue; } markedCoordGroup.TryAdd(key, 1); } return(markedCoordGroup .OrderByDescending(o => o.Value) .ToList()); }
public void Generate() { ShipGenerator.Generate(player, backgroundPrefab, alienPrefab, holderPrefab, platformPrefab, blockPrefab, pointPrefab, sizeX, sizeY, incrementX, incrementY, threshold); }