| | |
| | | /// 可以放置的 |
| | | /// </summary> |
| | | public Material canPlaceMat; |
| | | public Material canNotPlaceMat; |
| | | |
| | | /// <summary> |
| | | /// 放置在当前位置 |
| | |
| | | |
| | | if (isOn && towerName != "") |
| | | { |
| | | SetTowerVirtualshadow(towerName); |
| | | //SetTowerVirtualshadow(towerName); |
| | | EndlessWaveLineManager.instance.SetWaveLineShow(GridPosition.x, true); |
| | | } |
| | | else if (!isOn && towerVSRenderer.enabled) |
| | | else if (!isOn) |
| | | { |
| | | towerVSRenderer.enabled = false; |
| | | EndlessWaveLineManager.instance.SetWaveLineShow(GridPosition.x, false); |
| | | } |
| | | |
| | | } |
| | | |
| | | public void SetWarning(bool isOn) |
| | | { |
| | | canPlaceRenderer.material = isOn ? canNotPlaceMat : canPlaceMat; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | towerVSRenderer.enabled = false; |
| | | } |
| | | |
| | | private GameObject buyMesh; |
| | | public GameObject BuyMesh |
| | | { |
| | | get |
| | | { |
| | | return buyMesh; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据传入的参数来设置当前Grid对应的显示信息 |
| | |
| | | switch (newtype) |
| | | { |
| | | case PlacementGridType.EGridWaitBuy: |
| | | GameObject prefab = Resources.Load<GameObject>("Prefabs/BuyMesh"); |
| | | buyMesh = Instantiate(prefab, transform); |
| | | //Debug.Log("未开启塔位" + buyMesh); |
| | | |
| | | if (tileRenderer != null && waitBuyMat != null) |
| | | tileRenderer.sharedMaterial = waitBuyMat; |
| | | break; |
| | |
| | | if (tileRenderer != null && openMat != null) |
| | | tileRenderer.sharedMaterial = openMat; |
| | | } |
| | | |
| | | SetWarning(false); |
| | | if (buyMesh != null) |
| | | { |
| | | Destroy(buyMesh); |
| | | } |
| | | break; |
| | | case PlacementGridType.EGridDestroyed: |
| | | if (tileRenderer != null && destroyedMat != null) |