예제 #1
0
    static void StartGame()
    {
        //Set the gamestate
        gameState = GameState.Paused;

        //set the TileMapController
        tmc = GameObject.Find("TileMapController").GetComponent <TileMapController> ();
        tmc.StartGame();

        //Find a random square of Beach
        List <Tile> beaches = new List <Tile> ();

        for (int i = 0; i < fullMap.Width; i++)
        {
            for (int j = 0; j < fullMap.Height; j++)
            {
                if (fullMap.GetTile(i, j, 25).Biome == "Beach" && !fullMap.GetTile(i, j, 25).IsBlocked)
                {
                    beaches.Add(fullMap.GetTile(i, j, 25));
                }
            }
        }
        Tile startTile = beaches[Random.Range(0, beaches.Count)];

        startTile.Biome = "Start Location";
        Vector3 tilePos = tileMap.GetTilePosition(startTile.PointX, startTile.PointY);

        tilePos.z = Camera.main.transform.position.z;
        Camera.main.transform.position = tilePos;

        //Initialize the character list
        characters = new List <WorldObject> ();
        WorldObject dwarf = new WorldObject("Dwarf", startTile.PointX, startTile.PointY, 25);

        characters.Add(dwarf);
        //tmc.DrawWorldObj ();
    }