コード例 #1
0
ファイル: LevelGen.cs プロジェクト: danstev/Neritic
    void genTomb()
    {
        Dungeon2 r = new Dungeon2();

        boxMap = UnityEngine.Random.Range(60, 64);
        map    = new int[boxMap, boxMap];
        r.setMap(map);
        map     = r.genMap();
        tileMap = fillTileMap(map);
        renderMap(tileMap);
        xStart = r.sx * spaceMod;
        yStart = r.sy * spaceMod;
    }
コード例 #2
0
    /// <summary>
    /// Runs before the game starts.
    /// </summary>
    private void Awake()
    {
        if (controller != null)
        {
            Debug.LogWarning("Too many dungeon2 controllers!");
            return;
        }

        controller = this;
        Eventhandler.Instance.InteractableActivatedEvent.AddListener(InteractWithLever);
        playerObject = GameObject.Find("Player");
        playerObject.GetComponent <PlayerController>().MovePlayerToSpawn();
        UIController.UI.FadeIn();
    }
コード例 #3
0
ファイル: TestLevel.cs プロジェクト: danstev/Neritic
    void TestGenLevel()
    {
        Dungeon2 level = new Dungeon2();

        int[,] map = new int[64, 64];
        level.setMap(map);
        map = level.genMap();
        GameObject tile = Resources.Load("Prefabs/Tiles/forestFloor") as GameObject;

        for (int x = 0; x < map.GetLength(0); x++)
        {
            for (int y = 0; y < map.GetLength(1); y++)
            {
                if (map[x, y] != 0)
                {
                    Vector3    mapPos = new Vector3(x, 0, y);
                    GameObject g      = Instantiate(tile, mapPos, Quaternion.identity) as GameObject;
                    g.transform.rotation *= Quaternion.Euler(90, 0, 0);
                    g.isStatic            = true;
                }
            }
        }
    }