using Core.Utilities;
|
using KTGMGemClient;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
|
public class TowerPrice : Singleton<TowerPrice>
|
{
|
/// <summary>
|
/// 场景内的基础Tower价格.
|
/// </summary>
|
public int baseTowerPrice = 10;
|
/// <summary>
|
/// 每购买成功一个Tower,需要增加的TowerPrice.
|
/// </summary>
|
public int addPriceTower = 0;
|
|
/// <summary>
|
/// 当前场景内动态TowerPrice.
|
/// </summary>
|
protected int currentTP = 0;
|
protected int selfTpIdx = 0;
|
|
/// <summary>
|
/// 对手塔防的动态TowerPrice.
|
/// </summary>
|
protected int opponentTP = 0;
|
protected int oppoTpIdx = 0;
|
|
// Start is called before the first frame update
|
void Start()
|
{
|
this.currentTP = this.baseTowerPrice;
|
this.opponentTP = this.baseTowerPrice;
|
}
|
|
public int currentTowerPrice
|
{
|
get {
|
return this.currentTP;
|
}
|
}
|
|
public int opponentTowerPrice
|
{
|
get
|
{
|
return this.opponentTP;
|
}
|
}
|
|
public void resetTowerPrice()
|
{
|
this.currentTP = this.baseTowerPrice;
|
this.opponentTP = this.baseTowerPrice;
|
}
|
|
/// <summary>
|
/// 场景内每购买成功一个Tower,基础购买价格需要增加的数据。
|
/// </summary>
|
public void onTowerBuySuccess( bool opponent = false )
|
{
|
if(opponent)
|
{
|
this.oppoTpIdx++;
|
this.opponentTP = JsonDataCenter.GetGemCostFromIdx(oppoTpIdx) ;
|
}
|
else
|
{
|
this.selfTpIdx++;
|
this.currentTP = JsonDataCenter.GetGemCostFromIdx(selfTpIdx);
|
}
|
|
}
|
|
}
|