コード例 #1
0
        /// <summary>
        /// Add a TowerModel to the game.
        /// <br/>
        /// Using this method is preferable than modifying the GameModel's towers list manually, as this does more things
        /// to more fully integrate the tower within the game
        /// </summary>
        /// <param name="towerModel">TowerModel to add</param>
        /// <param name="towerDetailsModel">Optionally add a TowerDetailsModel for your towerModel</param>
        public static void AddTowerToGame(this GameModel model, TowerModel towerModel, TowerDetailsModel towerDetailsModel = null)
        {
            model.towers = model.towers.AddTo(towerModel);
            model.AddChildDependant(towerModel);

            ModTowerHelper.TowerCache[towerModel.name] = towerModel;

            if (towerDetailsModel != null)
            {
                model.AddTowerDetails(towerDetailsModel, towerModel.towerSet);
            }

            // MelonLogger.Msg($"Added towerModel {towerModel.name} to the game");
        }