public void OnValueChanged() { ObjScript = (PlaceBuilding)GameObject.Find("ContentParent").GetComponent(typeof(PlaceBuilding)); ObjScript.enabled = false; SetAllPlanesDeactive(false); SetAllPointsDeactive(false); }
public void SetItemCrops(GameObject CropsPrefab) { Debug.Log(CropsPrefab.name); hasPlaced = false; currentBuilding = ((GameObject)Instantiate(CropsPrefab)).transform; placeBuilding = currentBuilding.GetComponent <PlaceBuilding>(); }
public void SetItemWaterWell(GameObject WaterWell) { Debug.Log(WaterWell.name); hasPlaced = false; currentBuilding = ((GameObject)Instantiate(WaterWell)).transform; placeBuilding = currentBuilding.GetComponent <PlaceBuilding>(); }
public void SetItem(GameObject hut) { Debug.Log(hut.name); hasPlaced = false; currentBuilding = ((GameObject)Instantiate(hut)).transform; placeBuilding = currentBuilding.GetComponent <PlaceBuilding>(); }
void HandleInput() { if (Input.GetAxis("Fire2") > 0) { Vector3 pos = SelectPositon(Input.mousePosition); // instantiate event? Order(pos); unitSelector.transform.position = pos; } if (Input.GetAxis("Fire1") > 0) { //Debug.Log("selecting"); CreateUnitSelection(Input.mousePosition); if (buildingAction == true) { //Place building PlaceBuilding placeBuilding = mineBuilding.gameObject.GetComponent <PlaceBuilding>(); CheckGround checkGround = mineBuilding.gameObject.GetComponent <CheckGround>(); //Check if building can be placed if (checkGround.CheckSocket() == true && checkGround.CheckType() != BlockType.Regular) { placeBuilding.placingBuilding = false; buildingAction = false; checkGround.SetSocket(false); } } } else { // mouse was let go, reset if (selectionStarted) { CreateSelection(); } selectionStarted = false; // CollectUnits(); store units in list? } if (Input.GetKeyUp("b")) { //If no building action is in progress, enable placing mode if (buildingAction == false) { GameObject buildings = GameObject.Find("Buildings"); mineBuilding = Instantiate(minePrefab.transform, buildings.transform); buildingAction = true; } } }