Exemple #1
0
 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);
     }
 }
Exemple #2
0
        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());
        }
Exemple #3
0
 public void Generate()
 {
     ShipGenerator.Generate(player, backgroundPrefab, alienPrefab, holderPrefab, platformPrefab, blockPrefab, pointPrefab, sizeX, sizeY, incrementX, incrementY, threshold);
 }