Exemple #1
0
    public void CreateBoardingPlank()
    {
        if (createdPlank)
        {
            return;
        }

        createdPlank = true;

        Transform plank = Instantiate(plankPrefab, new Vector2(2, .25f), Quaternion.identity).transform;

        MovementTile[,] plankTiles = new MovementTile[2, 1];

        for (int x = 0; x < plankTiles.GetLength(0); x++)
        {
            for (int y = 0; y < plankTiles.GetLength(1); y++)
            {
                plankTiles [x, y]   = plank.GetChild(x * 1 + y).GetComponent <MovementTile> ();
                plankTiles [x, y].x = x;
                plankTiles [x, y].y = y;
            }
        }

        AStar.AddAreaToLayout(plankTiles);

        LevelLayout.Portal portalPlayerPlank = new LevelLayout.Portal(playerBoarding, plankTiles [0, 0]);
        AStar.AddPortalToLayout(portalPlayerPlank);

        LevelLayout.Portal portalPlankShip = new LevelLayout.Portal(plankTiles [1, 0], otherBoarding);
        AStar.AddPortalToLayout(portalPlankShip);
    }
Exemple #2
0
 public static void AddPortalToLayout(LevelLayout.Portal portal)
 {
     layout.portals.Add(portal);
     layout.GeneratePortalGraph();
 }