| | |
| | | using UnityEngine; |
| | | using TowerDefense.Level; |
| | | using UnityEditor; |
| | | using KTGMGemClient; |
| | | using Core.Utilities; |
| | | |
| | | namespace TowerDefense.UI.HUD |
| | | { |
| | |
| | | /// 可以放置的 |
| | | /// </summary> |
| | | public Material canPlaceMat; |
| | | public Material canNotPlaceMat; |
| | | |
| | | /// <summary> |
| | | /// 放置在当前位置 |
| | |
| | | |
| | | public ParticleSystem myOpenPS;//购买后的特效 |
| | | public ParticleSystem myPutPS;//交换塔位置后的特效 |
| | | |
| | | public GameObject myDragSelectPS;//推拽时候移动到当前塔的特效 |
| | | |
| | | /// <summary> |
| | | /// 所在的格子坐标 |
| | | /// </summary> |
| | | public IntVector2 GridPosition { get; set; } |
| | | |
| | | /// <summary> |
| | | /// Update the state of this placement tile |
| | |
| | | { |
| | | canPlaceRenderer.enabled = isOn; |
| | | } |
| | | if (myDragSelectPS.activeSelf != isOn) |
| | | { |
| | | myDragSelectPS.SetActive(isOn); |
| | | } |
| | | // if (isOn) |
| | | // { |
| | | // myDragSelectPS.Play(); |
| | | // } |
| | | // else |
| | | // { |
| | | // myDragSelectPS.Stop(); |
| | | // } |
| | | |
| | | if (isOn && towerName != "") |
| | | { |
| | | SetTowerVirtualshadow(towerName); |
| | | EndlessWaveLineManager.instance.SetWaveLineShow(GridPosition.x, true); |
| | | } |
| | | else if (!isOn && towerVSRenderer.enabled) |
| | | { |
| | | towerVSRenderer.enabled = false; |
| | | EndlessWaveLineManager.instance.SetWaveLineShow(GridPosition.x, false); |
| | | } |
| | | |
| | | } |
| | | |
| | | public void SetWarning(bool isOn) |
| | | { |
| | | canPlaceRenderer.material = isOn ? canNotPlaceMat : canPlaceMat; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | if (tileRenderer != null && openMat != null) |
| | | tileRenderer.sharedMaterial = openMat; |
| | | } |
| | | |
| | | if (canPlaceRenderer.material == canNotPlaceMat) |
| | | { |
| | | SetWarning(false); |
| | | } |
| | | break; |
| | | case PlacementGridType.EGridDestroyed: |
| | | if (tileRenderer != null && destroyedMat != null) |
| | |
| | | public void BuyPs() |
| | | { |
| | | myOpenPS?.Play(); |
| | | AudioSourceManager.Ins.Play(AudioEnum.OpenTowerPlace); |
| | | EndlessRandomTower.instance.CheckMoney(); |
| | | } |
| | | |
| | | public void PutPs() |