public int GetUpgradePrice(Point p, HouseInfo.UpgradeType type) { var scene = GetSceneLogic <FightSceneLogic>(); var house = scene.HouseGenerator[p.Row, p.Column]; var price = CalcUpgradePrice(type, house.GetUpgradeCount(type)); return(price); }
public HouseInfo UpgradeHouse(Point p, HouseInfo.UpgradeType type) { var scene = GetSceneLogic <FightSceneLogic>(); var house = scene.HouseGenerator[p.Row, p.Column]; var price = CalcUpgradePrice(type, house.GetUpgradeCount(type)); if (CostMoney(price)) { scene.HouseGenerator.UpgradeHouse(type, p.Row, p.Column); return(house); } else { return(null); } }
public int CalcUpgradePrice(HouseInfo.UpgradeType type, int currentCount) { var basis = 0; switch (type) { case HouseInfo.UpgradeType.Attack: basis = Config.UPGRADE_ATTACK_BASIS; break; case HouseInfo.UpgradeType.HP: basis = Config.UPGRADE_HP_BASIS; break; case HouseInfo.UpgradeType.Speed: basis = Config.UPGRADE_SPEED_BASIS; break; } return(basis * (currentCount + 1)); }
public HouseInfo UpgradeHouse(HouseInfo.UpgradeType type, int row, int col) { HouseInfo hInfo = _houseArray[row, col]; switch (type) { case HouseInfo.UpgradeType.Attack: hInfo.UpgradeAttack(); break; case HouseInfo.UpgradeType.HP: hInfo.UpgradeHP(); break; case HouseInfo.UpgradeType.Speed: hInfo.UpgradeSpeed(); break; } return(hInfo); }