| | |
| | | NULL, |
| | | BULLET, // 子弹塔 |
| | | ENERGY, // 能量充能. |
| | | FREEZE, // 水精灵充能 |
| | | END |
| | | } |
| | | |
| | |
| | | public BulletUICtl bulletCtl = null; |
| | | public EnergyUICtl energyCtl = null; |
| | | |
| | | public FreezeBreath FreezeBreathCtrl = null; |
| | | |
| | | /// <summary> |
| | | /// The tower levels associated with this tower |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | protected int progressOffset = 0; |
| | | |
| | | public int FreezeBreathProgressOffset { get; set; } |
| | | |
| | | public bool PlayWaveLineFlash { get; set; } = true; |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | public int uiProOffset |
| | | { |
| | | get { return this.progressOffset; } |
| | | set { this.progressOffset = value; } |
| | | get { return progressOffset; } |
| | | set { progressOffset = value; } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// Gets whether the tower can level up anymore |
| | |
| | | |
| | | if (opponentSide) |
| | | { |
| | | if (attack && (this.curActionState != 2)) |
| | | if (attack && (curActionState != 2)) |
| | | { |
| | | currentTowerLevel.SetTowerMonsterMat(materialTowerAttackOppo, true); |
| | | this.curActionState = 2; |
| | | curActionState = 2; |
| | | } |
| | | |
| | | if ((!attack) && (this.curActionState != 1)) |
| | | if ((!attack) && (curActionState != 1)) |
| | | { |
| | | currentTowerLevel.SetTowerMonsterMat(materialTowerWaitOppo, false); |
| | | this.curActionState = 1; |
| | | curActionState = 1; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (attack && (this.curActionState != 2)) |
| | | if (attack && (curActionState != 2)) |
| | | { |
| | | currentTowerLevel.SetTowerMonsterMat(materialTowerAttackSelf, true); |
| | | this.curActionState = 2; |
| | | curActionState = 2; |
| | | } |
| | | |
| | | if ((!attack) && (this.curActionState != 1)) |
| | | if ((!attack) && (curActionState != 1)) |
| | | { |
| | | currentTowerLevel.SetTowerMonsterMat(materialTowerWaitSelf, false); |
| | | this.curActionState = 1; |
| | | curActionState = 1; |
| | | } |
| | | } |
| | | } |
| | |
| | | /// <param name="play"></param> |
| | | public void PlayEnergyEffect(bool play, bool isClose = true) |
| | | { |
| | | if (this.energyCtl && isClose) |
| | | if (energyCtl && isClose) |
| | | energyCtl.gameObject.SetActive(!play); |
| | | else if (!isClose) |
| | | { |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 播放水精灵充能满了特效 |
| | | /// </summary> |
| | | /// <param name="play"></param> |
| | | /// <param name="isClose"></param> |
| | | public void PlayFreezeBreathEffect(bool play, bool isClose = true) |
| | | { |
| | | if (FreezeBreathCtrl && isClose) |
| | | FreezeBreathCtrl.gameObject.SetActive(!play); |
| | | |
| | | if (!opponentSide) |
| | | { |
| | | if (EndlessGameUI.instanceExists) |
| | | ((TowerPlacementGridEndless)EndlessGameUI.instance.selfTowerPlaceArea).PlayFreezeBreathEffect(gridPosition.x, gridPosition.y, play); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 当前是否处于攻击模式 |
| | | /// </summary> |
| | | public bool bInAttackMode |
| | | { |
| | | get { return this.m_bInAttackMode; } |
| | | get { return m_bInAttackMode; } |
| | | |
| | | // 设置是否处于攻击状态: |
| | | set |
| | |
| | | { |
| | | if (opponentSide) |
| | | { |
| | | OpponentMgr.instance.SetTowerAttID(gridPosition.x, attributeId, this.currentLevel); |
| | | OpponentMgr.instance.SetTowerAttID(gridPosition.x, attributeId, currentLevel); |
| | | } |
| | | else |
| | | { |
| | | if (LevelManager.instanceExists) |
| | | { |
| | | LevelManager.instance.SetTowerAttID(gridPosition.x, attributeId, this.currentLevel); |
| | | LevelManager.instance.SetTowerAttID(gridPosition.x, attributeId, currentLevel); |
| | | WaveLineSelMgr.instance.attackTowerFixed(gridPosition.x); |
| | | } |
| | | else if (EndlessLevelManager.instanceExists) |
| | | { |
| | | EndlessLevelManager.instance.SetTowerAttID(gridPosition.x, attributeId, this.currentLevel); |
| | | EndlessLevelManager.instance.SetTowerAttID(gridPosition.x, attributeId, currentLevel); |
| | | EndlessWaveLineManager.instance.AttackTowerFixed(gridPosition.x, PlayWaveLineFlash); |
| | | } |
| | | } |
| | |
| | | public void DisableTowerUICtrl() |
| | | { |
| | | // 根据是否是子弹塔防来决定是否显示相应的界面 |
| | | BulletUICtl buc = this.placementArea.GetBulletUICtl(gridPosition.x, gridPosition.y); |
| | | BulletUICtl buc = placementArea.GetBulletUICtl(gridPosition.x, gridPosition.y); |
| | | |
| | | if ((this.eTowerFuntion == ETowerFuntion.BULLET) && (buc != null)) |
| | | if ((eTowerFuntion == ETowerFuntion.BULLET) && (buc != null)) |
| | | { |
| | | buc.gameObject.SetActive(false); |
| | | this.bulletCtl = null; |
| | | bulletCtl = null; |
| | | } |
| | | |
| | | EnergyUICtl euc = placementArea.GetEnergyUICtl(gridPosition.x, gridPosition.y); |
| | |
| | | { |
| | | // 设置数据 |
| | | euc.gameObject.SetActive(false); |
| | | this.energyCtl = null; |
| | | energyCtl = null; |
| | | } |
| | | |
| | | return; |
| | | FreezeBreath ctrl = placementArea.GetFreezeBreath(gridPosition.x, gridPosition.y); |
| | | if (eTowerFuntion == ETowerFuntion.FREEZE && ctrl != null) |
| | | { |
| | | ctrl.gameObject.SetActive(false); |
| | | ctrl = null; |
| | | } |
| | | } |
| | | |
| | | public int GetTowerUICtrlProgress() |
| | | { |
| | | // 根据是否是子弹塔防来决定是否显示相应的界面 |
| | | BulletUICtl buc = this.placementArea.GetBulletUICtl(gridPosition.x, gridPosition.y); |
| | | BulletUICtl buc = placementArea.GetBulletUICtl(gridPosition.x, gridPosition.y); |
| | | |
| | | if ((this.eTowerFuntion == ETowerFuntion.BULLET) && (buc != null)) |
| | | if ((eTowerFuntion == ETowerFuntion.BULLET) && (buc != null)) |
| | | return buc.GetCtlProgress(); |
| | | |
| | | EnergyUICtl euc = placementArea.GetEnergyUICtl(gridPosition.x, gridPosition.y); |
| | | if ((eTowerFuntion == ETowerFuntion.ENERGY) && (euc != null)) |
| | | return euc.GetCtlProgress(); |
| | | |
| | | FreezeBreath ctrl = placementArea.GetFreezeBreath(gridPosition.x, gridPosition.y); |
| | | |
| | | if (eTowerFuntion == ETowerFuntion.FREEZE && ctrl != null) |
| | | return ctrl.CurrentProgress; |
| | | |
| | | return 0; |
| | | } |
| | |
| | | public void SetTowerUICtlProcess(int pro) |
| | | { |
| | | // 根据是否是子弹塔防来决定是否显示相应的界面 |
| | | BulletUICtl buc = this.placementArea.GetBulletUICtl(gridPosition.x, gridPosition.y); |
| | | BulletUICtl buc = placementArea.GetBulletUICtl(gridPosition.x, gridPosition.y); |
| | | |
| | | if ((this.eTowerFuntion == ETowerFuntion.BULLET) && (buc != null)) |
| | | if ((eTowerFuntion == ETowerFuntion.BULLET) && (buc != null)) |
| | | { |
| | | buc.SetCtlProcess(pro); |
| | | progressOffset = pro; |
| | | return; |
| | | } |
| | | |
| | | EnergyUICtl euc = placementArea.GetEnergyUICtl(gridPosition.x, gridPosition.y); |
| | |
| | | progressOffset = pro; |
| | | if (progressOffset == 10) |
| | | progressOffset = 0; |
| | | } |
| | | |
| | | |
| | | |
| | | return; |
| | | } |
| | | |
| | | FreezeBreath ctrl = placementArea.GetFreezeBreath(gridPosition.x, gridPosition.y); |
| | | |
| | | if (eTowerFuntion == ETowerFuntion.FREEZE && ctrl != null) |
| | | { |
| | | ctrl.SetCtrlProgress(pro); |
| | | FreezeBreathProgressOffset = pro; |
| | | if (FreezeBreathProgressOffset == 10) |
| | | FreezeBreathProgressOffset = 0; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 充能技能相关的代码开关。包括子弹充能和时间充能 |
| | | /// </summary> |
| | | protected void OnTowerUICtrl() |
| | | { |
| | | HandleBulletUICtrl(); |
| | | HandleEnergyUICtrl(); |
| | | HandleFreezeBreathCtrl(); |
| | | } |
| | | |
| | | private void HandleBulletUICtrl() |
| | | { |
| | | // 根据是否是子弹塔防来决定是否显示相应的界面 |
| | | BulletUICtl buc = this.placementArea.GetBulletUICtl(gridPosition.x, gridPosition.y); |
| | | BulletUICtl buc = placementArea.GetBulletUICtl(gridPosition.x, gridPosition.y); |
| | | |
| | | if (buc == null) return; |
| | | |
| | | if ((this.eTowerFuntion == ETowerFuntion.BULLET) && (buc != null)) |
| | | if ((eTowerFuntion == ETowerFuntion.BULLET) && (buc != null)) |
| | | { |
| | | // 设置数据 |
| | | buc.gameObject.SetActive(true); |
| | | this.bulletCtl = buc; |
| | | bulletCtl = buc; |
| | | buc.resetToMaxBullet(); |
| | | } |
| | | else |
| | | { |
| | | // 清空数据 |
| | | buc.gameObject.SetActive(false); |
| | | this.bulletCtl = null; |
| | | bulletCtl = null; |
| | | } |
| | | } |
| | | |
| | | private void HandleEnergyUICtrl() |
| | | { |
| | | // 根据是否是能量充能来决定是否显示相应的界面. |
| | | EnergyUICtl euc = placementArea.GetEnergyUICtl(gridPosition.x, gridPosition.y); |
| | | if ((eTowerFuntion == ETowerFuntion.ENERGY) && (euc != null)) |
| | | { |
| | | // 设置数据 |
| | | euc.gameObject.SetActive(true); |
| | | this.energyCtl = euc; |
| | | energyCtl = euc; |
| | | euc.SetEnergyProgress(0); |
| | | } |
| | | else |
| | | { |
| | | // 清空数据 |
| | | euc.gameObject.SetActive(false); |
| | | this.energyCtl = null; |
| | | energyCtl = null; |
| | | } |
| | | } |
| | | |
| | | private void HandleFreezeBreathCtrl() |
| | | { |
| | | FreezeBreath ctrl = placementArea.GetFreezeBreath(gridPosition.x, gridPosition.y); |
| | | |
| | | if (eTowerFuntion == ETowerFuntion.FREEZE && ctrl != null) |
| | | { |
| | | ctrl.gameObject.SetActive(true); |
| | | FreezeBreathCtrl = ctrl; |
| | | ctrl.SetProgress(0); |
| | | } |
| | | else |
| | | { |
| | | ctrl.gameObject.SetActive(false); |
| | | FreezeBreathCtrl = null; |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | energyCtl.gameObject.SetActive(false); |
| | | } |
| | | |
| | | if (FreezeBreathCtrl != null) |
| | | FreezeBreathCtrl.gameObject.SetActive(false); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | // 设置攻击数据的加强,暂时是测试数据,后面需要读取表格数据处理: |
| | | float damageAdd = 0; |
| | | // float damageAdd = (inSceneTowerLevel - 1) * this.INSCENE_TU_DAMAGE; |
| | | for (int ti = 0; ti < this.levels.Length; ti++) |
| | | // float damageAdd = (inSceneTowerLevel - 1) * INSCENE_TU_DAMAGE; |
| | | for (int ti = 0; ti < levels.Length; ti++) |
| | | { |
| | | if (levels[ti].levelDamager) |
| | | { |
| | |
| | | |
| | | protected void ResetInSceneTowerLevel() |
| | | { |
| | | for (int ti = 0; ti < this.levels.Length; ti++) |
| | | for (int ti = 0; ti < levels.Length; ti++) |
| | | { |
| | | if (levels[ti].levelDamager) |
| | | { |
| | |
| | | inSceneTowerLevel++; |
| | | |
| | | // 设置攻击数据的加强,暂时是测试数据,后面需要读取表格数据处理: |
| | | float damageAdd = inSceneTowerLevel * this.INSCENE_TU_DAMAGE; |
| | | float damageAdd = inSceneTowerLevel * INSCENE_TU_DAMAGE; |
| | | |
| | | for (int ti = 0; ti < this.levels.Length; ti++) |
| | | for (int ti = 0; ti < levels.Length; ti++) |
| | | { |
| | | if (levels[ti].levelDamager) |
| | | { |
| | |
| | | EndlessLevelManager.instance.LevelStateChanged += OnLevelStateChanged; |
| | | |
| | | // 查找Targetter: |
| | | Targetter target = this.GetComponentInChildren<Targetter>(); |
| | | Targetter target = GetComponentInChildren<Targetter>(); |
| | | if (target) |
| | | { |
| | | target.bOpponent = this.opponentSide; |
| | | target.bOpponent = opponentSide; |
| | | } |
| | | else |
| | | Debug.Log("在当前的Tower中找不到Targetter."); |
| | | |
| | | // |
| | | // 初始化当前的局内Tower等级数据 |
| | | this.initInSceneTowerLevel(SceneTowerLvl.getInSceneTowerLvl(this.towerName)); |
| | | initInSceneTowerLevel(SceneTowerLvl.getInSceneTowerLvl(towerName)); |
| | | |
| | | StartCoroutine(ResetScale()); |
| | | } |
| | |
| | | { |
| | | if (vis) |
| | | { |
| | | this.gameObject.SetActive(true); |
| | | gameObject.SetActive(true); |
| | | } |
| | | else |
| | | { |
| | | this.gameObject.SetActive(false); |
| | | gameObject.SetActive(false); |
| | | } |
| | | } |
| | | |