/// <summary> /// Method used to create a building game object based on the type of building. /// Allows one method call to decide which type of building model shall be loaded /// </summary> /// <param name="penumBuildingType"></param> /// <param name="penumGodType"></param> /// <returns></returns> private GameObject CreateBuildingObject(BUILDING_TYPE penumBuildingType, Faction.GodType penumGodType) { GameObject uniBuildingGameObject = null; string strResourceKey = "Buildings/" + penumGodType.ToString() + penumBuildingType.ToString() + UpgradeLevel.ToString(); // Load the building model from memory if (mdictBuildingResources.ContainsKey(strResourceKey) && mdictBuildingResources[strResourceKey] != null) { uniBuildingGameObject = (GameObject)GameObject.Instantiate( mdictBuildingResources[strResourceKey]); } else { #if DEBUG // Model was not found in resources folder, this should not occur as all models have been created now #endif } // Check to ensure a game model was found when creating if (uniBuildingGameObject != null) { // Add a linerenderer for outlining, scale based on scene parameters // Allows for the outlining of buildings when selected or when building other buildings uniBuildingGameObject.AddComponent <LineRenderer>().positionCount = 0; uniBuildingGameObject.transform.localScale = new Vector3(ObjectRadius, ObjectRadius, ObjectRadius); } return(uniBuildingGameObject); }
/// <summary> /// Method for loading the management scene as a new game /// Initializes a blank game info object to allow the game manager to create new data /// </summary> /// <param name="pstrGodName"></param> /// <param name="penumGodType"></param> public void StartNewGame(string pstrGodName, Faction.GodType penumGodType) { Animator uniAnimation = GetComponent <Animator>(); // Create an empty game info object, management scene will create starting scene GameObject uniNewGameInfoObject = (GameObject)Instantiate(GameInfoObjectPrefab); uniNewGameInfoObject.name = "GameInfo"; mmusGameInfo = uniNewGameInfoObject.GetComponent <GameInfo>(); mmusGameInfo.PlayerFaction.GodName = pstrGodName; mmusGameInfo.PlayerFaction.Type = penumGodType; StartCoroutine(PlayNewGameAnimation()); }
/// <summary> /// Create an initial tier reward tree based on the given god type. /// Allows for the same tier reward tree on each play through for balancing. /// Can be moved to/loaded from file for more modularity in future. /// </summary> /// <param name="penumGodType"></param> /// <returns></returns> public static List <TierReward> CreateTierRewardTree(Faction.GodType penumGodType) { List <TierReward> arrPlayerTierRewardTree = null; switch (penumGodType) { case Faction.GodType.Mushrooms: arrPlayerTierRewardTree = CreateMushroomRewardTree(); break; case Faction.GodType.Ducks: arrPlayerTierRewardTree = CreateDuckRewardTree(); break; case Faction.GodType.Shoes: arrPlayerTierRewardTree = CreateShoeRewardTree(); break; case Faction.GodType.Forks: arrPlayerTierRewardTree = CreateForkRewardTree(); break; } return(arrPlayerTierRewardTree); }