コード例 #1
0
 private Town[] InitializeTowns()
 {
     SpawnTowns(NUMBER_OF_TOWNS_TO_SPAWN);
     townPlayerAt = FindPoorestTown();
     Instantiate(MapAssets.GetInstance().RedCircle, new Vector3(townPlayerAt.GetLocation().x, townPlayerAt.GetLocation().y - 1, townPlayerAt.GetLocation().z), Quaternion.identity);
     return(towns);
 }
コード例 #2
0
    private void SpawnTowns(int numTowns)
    {
        towns = new Town[numTowns];
        for (int i = 0; i < numTowns; i++)
        {
            towns[i] = SpawnTown();
            Vector3 loc = towns[i].GetLocation();

            Instantiate(MapAssets.GetInstance().Town, new Vector3(loc.x, loc.y, loc.z), Quaternion.identity);
        }
    }
コード例 #3
0
    private void Awake()
    {
        //If this is the first time map is loaded, instantiate global values
        if (GlobalValues.MaxHealth == 0)
        {
            Debug.Log("Instantiating Global Values");
            GlobalValues.CurrentScene  = GlobalValues.Scene.Map;
            GlobalValues.MaxHealth     = 80;
            GlobalValues.CurrentHealth = GlobalValues.MaxHealth;
            GlobalValues.Money         = 100;
            GlobalValues.Deck          = InitializeDeck();
            GlobalValues.Towns         = InitializeTowns();
            GlobalValues.TownPlayerAt  = townPlayerAt;
        }
        //If not, we load in our GlobalValues
        else
        {
            GlobalValues.CurrentScene = GlobalValues.Scene.Map;
            Debug.Log("Loading Global Values");
            towns = GlobalValues.Towns;
            foreach (Town t in towns)
            {
                Instantiate(MapAssets.GetInstance().Town, new Vector3(t.GetLocation().x, t.GetLocation().y, t.GetLocation().z), Quaternion.identity);
            }
            townPlayerAt = GlobalValues.TownPlayerAt;
            Instantiate(MapAssets.GetInstance().RedCircle, new Vector3(townPlayerAt.GetLocation().x, townPlayerAt.GetLocation().y - 1, townPlayerAt.GetLocation().z), Quaternion.identity);
        }

        /*
         * SpawnTowns(NUMBER_OF_TOWNS_TO_SPAWN);
         * foreach (Town t in towns)
         *  t.LogTown();
         *
         * townPlayerAt = FindPoorestTown();
         * Instantiate(MapAssets.GetInstance().RedCircle, new Vector3(townPlayerAt.GetLocation().x, townPlayerAt.GetLocation().y-1, townPlayerAt.GetLocation().z), Quaternion.identity);
         */
    }