コード例 #1
0
    // Use this for initialization
    void Start()
    {
        GameObject[] trees = GameObject.FindGameObjectsWithTag("Tree");
        foreach (GameObject tree in trees)
        {
            Mesh myMesh = treeMeshs[Random.Range(0, treeMeshs.Length)];
            tree.GetComponent <MeshFilter> ().mesh        = myMesh;
            tree.GetComponent <MeshCollider>().sharedMesh = myMesh;
        }

        myPathfinder.OnStart(new Vector2(50, 50));
    }
コード例 #2
0
    private void GenerateMap()
    {
        myPathfinding = GetComponent <MyPathfinding>();
        map           = new int[width, height];
        RandomFillMap();
        while (changes > 0)
        {
            changes = 0;
            SmoothMap();
        }
        changes = 1;

        CheckWalls();
        PlaceEnemies();
        GenerateTrees();
        GenerateChests();
        PlaceDoors();
        myPathfinding.OnStart(new Vector2(width, height) * scale);
    }