| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using UnityEngine;
- using System.Collections.Generic;
- /// <summary>
- /// Data-only structure for shop generation (not a MonoBehaviour)
- /// Used by SettlementContext to define shop properties
- /// </summary>
- [System.Serializable]
- public class ShopData
- {
- public string buildingName;
- public ShopType shopType;
- public string shopkeeperName;
- public Vector2Int gridPosition;
- public Color buildingColor;
- public bool isAvailable;
- public ShopData(string name, ShopType type, string keeper, Vector2Int position, Color color)
- {
- buildingName = name;
- shopType = type;
- shopkeeperName = keeper;
- gridPosition = position;
- buildingColor = color;
- isAvailable = true;
- }
- /// <summary>
- /// Convert this ShopData to a TownShop component on the given GameObject
- /// </summary>
- public TownShop ApplyToTownShop(GameObject shopObject)
- {
- var townShop = shopObject.GetComponent<TownShop>();
- if (townShop == null)
- townShop = shopObject.AddComponent<TownShop>();
- townShop.buildingName = buildingName;
- townShop.shopType = shopType;
- townShop.shopkeeperName = shopkeeperName;
- townShop.gridPosition = gridPosition;
- townShop.buildingColor = buildingColor;
- return townShop;
- }
- }
|