Ejemplo n.º 1
0
    /// <summary>
    /// NOTE: This will modify the internal spawn list for the GameWallHolder this
    /// is associated with
    /// </summary>
    /// <returns></returns>
    public SpawnLocations GetValidSpawnLocations()
    {
        wallHolder.GetWalls();
        SpawnLocations spawnLocations = new SpawnLocations();
        float          xCheck         = minPosition.x;
        float          yCheck         = maxPosition.y;
        Collider2D     pointCollider  = point.Collider;

        while (yCheck >= minPosition.y)
        {
            Vector3 newPos = new Vector3(xCheck, yCheck, 0);
            point.transform.position = newPos;

            if (!PointTooCloseToWall(newPos))
            {
                spawnLocations.Add(new SpawnLocation(newPos));
            }

            xCheck += increments;
            if (xCheck > maxPosition.x)
            {
                xCheck  = minPosition.x;
                yCheck -= increments;
            }
        }

        return(spawnLocations);
    }
Ejemplo n.º 2
0
 public void CreateLevel(LevelInfo level)
 {
     foreach (Wall wall in level.GameWalls)
     {
         GameWall childWall = Instantiate(wallPrefab, transform);
         childWall.SetParameters(wall);
     }
     levelName = level.Name;
     locations = new SpawnLocations(level.PointSpawns.Count);
     foreach (SpawnLocation location in level.PointSpawns)
     {
         locations.Add(location);
     }
     GetWalls();
 }