示例#1
0
    /// <summary>
    /// Creates a link from the current tile and in the direction given by methodDirection, to the
    /// node indicated by the linkToIndex.
    /// Also called by the createTileChunk() method in order to ensure that the player can access the
    /// newly created chunk, in which case it used the (x,y) coordinates given by (linkX, LinkY)
    /// </summary>
    /// <param name="newChunk"></param>
    public void createLink(bool newChunk = false)
    {
        getCurrentNode();       // make sure node reference is current
        getCurrentMap();        // make sure map reference is current

        if (newChunk)           // if creating a link to a new chunk, use this method to create link
        {
            if ((linkX >= 0) && (linkY >= 0) && (linkX < newChunkWidth) && (linkY < newChunkHeight))
            {
                int toIndex = chunkToLink[(int)linkX, (int)linkY].index;
                LevelEditor_2.createTwoWayLink(currentMap, currentNode.index, toIndex, methodDirection);
            }
            else
            {
                Debug.Log("Error: The location to link to: (" + linkX + "," + linkY + ") the the new chunk the is " + newChunkWidth + "x" + newChunkHeight + " is not valid");
            }
        }
        else if ((linkToIndex >= 0) && (linkToIndex < currentMap.size) && (currentMap[linkToIndex] != null))             // otherwisse use this method to create link
        {
            if (linkDirectionality == LinkDirectionality.Twoway)
            {
                LevelEditor_2.createTwoWayLink(currentMap, currentNode.index, (int)linkToIndex, methodDirection);
            }
            else
            {
                LevelEditor_2.createOneWayLink(currentMap, currentNode.index, (int)linkToIndex, methodDirection);
            }
        }
        else
        {
            Debug.Log("Error: Given index of " + linkToIndex + " is not valid");
        }
        getCurrentNode();                                                                                    // current node will have changed slightly, make sure copy is still accurate
        GameManager.gameplay.nonEuclidRenderer.HandleRender(GameManager.Direction.East, currentNode, false); // draw changes to map
    }
示例#2
0
    public static Map generateRoom()
    {
        Map demoMap = new Map();

        // This map demonstrates the ways that connects can be very wierd
        // Demonstrates cunfusing, undesired behavior

        List <LevelEditor_2.TileCoord> emptyTiles = new List <LevelEditor_2.TileCoord>();

        emptyTiles.Add(new LevelEditor_2.TileCoord(0, 0));
        emptyTiles.Add(new LevelEditor_2.TileCoord(0, 2));
        emptyTiles.Add(new LevelEditor_2.TileCoord(2, 0));
        emptyTiles.Add(new LevelEditor_2.TileCoord(2, 2));

        Node[,] chunk = LevelEditor_2.createChunk(demoMap, new Color32(255, 255, 200, 255), 3, 3, emptyTiles);

        LevelEditor_2.createOneWayLink(
            chunk,
            chunk,
            new LevelEditor_2.TileCoord(1, 0),
            new LevelEditor_2.TileCoord(0, 1),
            LevelEditor_2.Direction.North
            );

        LevelEditor_2.createOneWayLink(
            chunk,
            chunk,
            new LevelEditor_2.TileCoord(0, 1),
            new LevelEditor_2.TileCoord(1, 0),
            LevelEditor_2.Direction.West
            );

        LevelEditor_2.createTwoWayLink(
            chunk,
            chunk,
            new LevelEditor_2.TileCoord(1, 2),
            new LevelEditor_2.TileCoord(2, 1),
            LevelEditor_2.Direction.South
            );

        LevelEditor_2.createTwoWayLink(
            chunk,
            chunk,
            new LevelEditor_2.TileCoord(2, 1),
            new LevelEditor_2.TileCoord(1, 2),
            LevelEditor_2.Direction.East
            );

        return(demoMap);
    }
    override public LevelMap generateRoom()
    {
        LevelMap demoMap = new LevelMap();

        //Demo room map, relativly complex

        List <LevelEditor_2.TileCoord> emptyTiles1 = new List <LevelEditor_2.TileCoord>();

        emptyTiles1.Add(new LevelEditor_2.TileCoord(1, 1));
        //emptyTiles1.Add(new LevelEditor_2.TileCoord(2, 0));
        //emptyTiles1.Add(new LevelEditor_2.TileCoord(1, 2));

        Node[,] chunk1 = LevelEditor_2.createChunk(demoMap, new Color32(150, 150, 255, 255), 3, 3, emptyTiles1);
        Node[,] chunk2 = LevelEditor_2.createChunk(demoMap, new Color32(150, 150, 255, 255), 3, 3, emptyTiles1);

        LevelEditor_2.createTwoWayLink(
            chunk1,
            chunk2,
            new LevelEditor_2.TileCoord(2, 2),
            new LevelEditor_2.TileCoord(1, 0),
            GameManager.Direction.West
            );

        LevelEditor_2.createTwoWayLink(
            chunk1,
            chunk2,
            new LevelEditor_2.TileCoord(1, 2),
            new LevelEditor_2.TileCoord(2, 0),
            GameManager.Direction.East
            );

        LevelEditor_2.createOneWayLink(
            chunk1,
            chunk1,
            new LevelEditor_2.TileCoord(1, 2),
            new LevelEditor_2.TileCoord(2, 2),
            GameManager.Direction.East
            );

        LevelEditor_2.setSource(demoMap, chunk1, new LevelEditor_2.TileCoord(1, 0));
        //LevelEditor_2.setTarget(demoMap, chunk6, new LevelEditor_2.TileCoord(0, 0));

        return(demoMap);
    }
示例#4
0
    override public LevelMap generateRoom()
    {
        LevelMap _map = new LevelMap();

        //This Room will show the player that they can move from one pink tile to the next

        List <LevelEditor_2.TileCoord> Chunk1EmptyTiles = new List <LevelEditor_2.TileCoord>
        {
            new LevelEditor_2.TileCoord(3, 1),
            new LevelEditor_2.TileCoord(3, 2),
            new LevelEditor_2.TileCoord(3, 3),
            new LevelEditor_2.TileCoord(3, 4),
            new LevelEditor_2.TileCoord(3, 5),
            new LevelEditor_2.TileCoord(3, 6),
        };

        Node[,] chunk1 = LevelEditor_2.createChunk(_map, new Color32(244, 173, 66, 255), 4, 9, Chunk1EmptyTiles);
        Node[,] chunk2 = LevelEditor_2.createChunk(_map, Color.cyan, 2, 4);
        Node[,] chunk3 = LevelEditor_2.createChunk(_map, Color.red, 2, 4);

        LevelEditor_2.createTwoWayLink(
            chunk1,
            chunk2,
            new LevelEditor_2.TileCoord(3, 7),
            new LevelEditor_2.TileCoord(0, 2),
            GameManager.Direction.East
            );
        LevelEditor_2.createTwoWayLink(
            chunk1,
            chunk2,
            new LevelEditor_2.TileCoord(3, 8),
            new LevelEditor_2.TileCoord(0, 3),
            GameManager.Direction.East
            );
        LevelEditor_2.createTwoWayLink(
            chunk1,
            chunk3,
            new LevelEditor_2.TileCoord(3, 0),
            new LevelEditor_2.TileCoord(0, 0),
            GameManager.Direction.East
            );
        LevelEditor_2.createOneWayLink(
            chunk2,
            chunk1,
            new LevelEditor_2.TileCoord(0, 0),
            new LevelEditor_2.TileCoord(3, 0),
            GameManager.Direction.West
            );
        LevelEditor_2.createOneWayLink(
            chunk3,
            chunk1,
            new LevelEditor_2.TileCoord(0, 2),
            new LevelEditor_2.TileCoord(3, 7),
            GameManager.Direction.West
            );
        LevelEditor_2.createOneWayLink(
            chunk3,
            chunk1,
            new LevelEditor_2.TileCoord(0, 3),
            new LevelEditor_2.TileCoord(3, 8),
            GameManager.Direction.West
            );

        LevelEditor_2.setSource(_map, chunk1, new LevelEditor_2.TileCoord(2, 6));
        LevelEditor_2.setTarget(_map, chunk3, new LevelEditor_2.TileCoord(1, 1));

        return(_map);
    }
示例#5
0
    public static Map generateRoom()
    {
        Map demoMap = new Map();

        //Demo room map, relativly complex

        List <LevelEditor_2.TileCoord> emptyTiles1 = new List <LevelEditor_2.TileCoord>();

        emptyTiles1.Add(new LevelEditor_2.TileCoord(0, 0));
        emptyTiles1.Add(new LevelEditor_2.TileCoord(2, 0));
        emptyTiles1.Add(new LevelEditor_2.TileCoord(1, 2));

        Node[,] chunk1 = LevelEditor_2.createChunk(demoMap, new Color32(255, 200, 100, 255), 3, 4, emptyTiles1);
        Node[,] chunk2 = LevelEditor_2.createChunk(demoMap, new Color32(100, 100, 255, 255), 3, 4, emptyTiles1);

        LevelEditor_2.createOneWayLink(
            chunk1,
            chunk2,
            new LevelEditor_2.TileCoord(0, 3),
            new LevelEditor_2.TileCoord(1, 3),
            LevelEditor_2.Direction.East
            );
        LevelEditor_2.createOneWayLink(
            chunk2,
            chunk1,
            new LevelEditor_2.TileCoord(2, 3),
            new LevelEditor_2.TileCoord(1, 3),
            LevelEditor_2.Direction.West
            );


        List <LevelEditor_2.TileCoord> emptyTiles2 = new List <LevelEditor_2.TileCoord>();

        emptyTiles2.Add(new LevelEditor_2.TileCoord(1, 1));

        Node[,] chunk3 = LevelEditor_2.createChunk(demoMap, new Color32(255, 0, 0, 255), 3, 3, emptyTiles2);
        Node[,] chunk4 = LevelEditor_2.createChunk(demoMap, new Color32(0, 255, 0, 255), 2, 1);
        Node[,] chunk5 = LevelEditor_2.createChunk(demoMap, new Color32(0, 0, 255, 255), 1, 2);

        LevelEditor_2.createTwoWayLink(
            chunk3,
            chunk4,
            new LevelEditor_2.TileCoord(0, 1),
            new LevelEditor_2.TileCoord(0, 0),
            LevelEditor_2.Direction.East
            );

        LevelEditor_2.createTwoWayLink(
            chunk3,
            chunk4,
            new LevelEditor_2.TileCoord(2, 1),
            new LevelEditor_2.TileCoord(1, 0),
            LevelEditor_2.Direction.West
            );

        LevelEditor_2.createTwoWayLink(
            chunk3,
            chunk5,
            new LevelEditor_2.TileCoord(1, 0),
            new LevelEditor_2.TileCoord(0, 0),
            LevelEditor_2.Direction.South
            );

        LevelEditor_2.createTwoWayLink(
            chunk3,
            chunk5,
            new LevelEditor_2.TileCoord(1, 2),
            new LevelEditor_2.TileCoord(0, 1),
            LevelEditor_2.Direction.North
            );

        LevelEditor_2.createTwoWayLink(
            chunk1,
            chunk3,
            new LevelEditor_2.TileCoord(1, 0),
            new LevelEditor_2.TileCoord(1, 2),
            LevelEditor_2.Direction.North
            );

        Node[,] chunk6 = LevelEditor_2.createChunk(demoMap, new Color32(50, 50, 50, 255), 1, 1);

        LevelEditor_2.createTwoWayLink(
            chunk3,
            chunk6,
            new LevelEditor_2.TileCoord(0, 0),
            new LevelEditor_2.TileCoord(0, 0),
            LevelEditor_2.Direction.West
            );

        LevelEditor_2.setSource(chunk2, new LevelEditor_2.TileCoord(1, 0));
        LevelEditor_2.setTarget(chunk6, new LevelEditor_2.TileCoord(0, 0));

        return(demoMap);
    }