private GroundCube InstantiateCube(Key pos) { GroundCube _temp = Instantiate(CubePrefab, transform); _temp.InitializeCube(pos); return(_temp); }
private void ClearTile() { _ray = Camera.main.ScreenPointToRay(touch.ScreenPos); if (Physics.Raycast(_ray, out _hit, Mathf.Infinity, GroundCubeLayer)) { GroundCube temp = _hit.transform.GetComponent <GroundCube>(); temp.UpgradeTile(CubeUpgradeTypes.Nil); } }
private void OnTriggerExit(Collider other) { if (other.tag == "Building" || other.tag == "Wall") { obj.Remove(other.gameObject); } if (other.tag == "GroundCube") { GroundCube gc = other.GetComponent <GroundCube>(); Cubes.Remove(gc); gc.Selection(); } ChangeColor(); }
//----this is the exact opposit of OnTriggerEnter private void OnTriggerExit(Collider other) { if (other.CompareTag("Building") || other.CompareTag("Wall")) { obj.Remove(other.gameObject);//----notice we're removing it from the list } if (other.CompareTag("GroundCube")) { GroundCube gc = other.GetComponent <GroundCube>(); cubes.Remove(gc);//----removing it from the list gc.HandleSelection(); } ChangeColor(); }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Building") || other.CompareTag("Wall")) //hit a building or a wall?...... { obj.Add(other.gameObject); //then stick it in the obj list..... } if (other.CompareTag("GroundCube")) //hit a ground cube?......... { GroundCube gc = other.GetComponent <GroundCube>(); //get the ground cube script that is sitting on this particular gameobject..... cubes.Add(gc); //add it to the ground cubes list.... gc.HandleSelection(); //toggle the selection color of this particular ground cube...... } ChangeColor(); //<----no check if the color should be green or red }
private void OnTriggerExit(Collider other) { if (other.CompareTag("Building") || other.CompareTag("Wall") || other.CompareTag("Minion")) { gosBumped.Remove(other.gameObject);//----notice we're removing it from the list } if (other.CompareTag("GroundCube")) { GroundCube gc = other.GetComponent <GroundCube>(); cubes.Remove(gc); if (gc.tile.isPathway == false && buildMode == BuildMode.Building) { gc.SetSelection(false); } } ChangeColor(); }
private void OnTriggerEnter(Collider other) { //hit a building or minion? if (other.CompareTag("Building") || other.CompareTag("Wall") || other.CompareTag("Minion")) { //Debug.Log("Hit "+ other.gameObject.name + "!"); gosBumped.Add(other.gameObject); } //hit a ground cube? if (other.CompareTag("GroundCube")) { //Debug.Log("Hit groundtube!"); GroundCube gc = other.GetComponent <GroundCube>(); cubes.Add(gc); if (isPreviewing && buildMode == BuildMode.Building) { if (gc.tile.isPathway == false) { gc.SetSelection(true); } } } ChangeColor(); }