void OnMouseDown() { //blocks the player if they are hovering over a UI overlay. if (EventSystem.current.IsPointerOverGameObject()) { return; } //if there is already a turret, then it will select the node instead. if (tower != null) { buildmanager_script.SelectNode(this); return; } //if the player aren't able to build, then exit out now. if (!buildmanager_script.CanBuild) { return; } //otherwise, build the selected turret on top of this node. BuildTurret(buildmanager_script.GetTurretToBuild()); }
public void Build() { buildmanager.DestroyPreturret(); BuildTurret(buildmanager.GetTurretToBuild()); //GetTurretToBuild會回傳要蓋的塔的藍圖 }