public bool notifyWhenWorkReached() { if (buildingInsideOf) { if (buildingInsideOf.Equals(work.getBuildingName())) { return(true); } } return(false); }
public void instantiateUnfinishedBuilding() { //yield return new WaitForSeconds(0.5f); // ITEMSNEEDEDTOCRAFT, MAXBUILDERPROGRESS, MAXMATERIALPROGRESS itemsNeededToCraft = gameManager.getBuildingCatalog().getBuildingByName(building.getBuildingName()).getCostToCraftBuilding(); foreach (var item in itemsNeededToCraft) { maxBuilderProgress += item.Value; maxMaterialProgress += item.Value; } // INDICATORS if (transform.Find("Object Indicator")) { if (building.transform.GetComponentInChildren <MeshRenderer>().transform.parent.GetComponent <BoxCollider>()) { transform.Find("Object Indicator/Green indicator").GetComponent <SpriteRenderer>().size = new Vector2(building.transform.GetComponentInChildren <MeshRenderer>().transform.parent.GetComponent <BoxCollider>().size.x, building.transform.GetComponentInChildren <MeshRenderer>().transform.parent.GetComponent <BoxCollider>().size.z); transform.Find("Object Indicator/Red indicator").GetComponent <SpriteRenderer>().size = new Vector2(building.transform.GetComponentInChildren <MeshRenderer>().transform.parent.GetComponent <BoxCollider>().size.x, building.transform.GetComponentInChildren <MeshRenderer>().transform.parent.GetComponent <BoxCollider>().size.z); } else { transform.Find("Object Indicator/Green indicator").GetComponent <SpriteRenderer>().size = new Vector2(building.transform.GetComponentInChildren <NavMeshObstacle>().size.x *building.transform.GetComponentInChildren <NavMeshObstacle>().transform.localScale.x, building.transform.GetComponentInChildren <NavMeshObstacle>().size.z *building.transform.GetComponentInChildren <NavMeshObstacle>().transform.localScale.z); transform.Find("Object Indicator/Red indicator").GetComponent <SpriteRenderer>().size = new Vector2(building.transform.GetComponentInChildren <NavMeshObstacle>().size.x *building.transform.GetComponentInChildren <NavMeshObstacle>().transform.localScale.x, building.transform.GetComponentInChildren <NavMeshObstacle>().size.z *building.transform.GetComponentInChildren <NavMeshObstacle>().transform.localScale.z); } //buildingIndicatorOff(); } // GROUND SPRITE transform.Find("Ground").GetComponent <SpriteRenderer>().size = new Vector2(transform.Find("Object Indicator/Green indicator").GetComponent <SpriteRenderer>().size.x, transform.Find("Object Indicator/Green indicator").GetComponent <SpriteRenderer>().size.y); // BOX COLLIDER GetComponent <BoxCollider>().size = new Vector3(transform.Find("Object Indicator/Green indicator").GetComponent <SpriteRenderer>().size.x, this.transform.position.y, transform.Find("Object Indicator/Green indicator").GetComponent <SpriteRenderer>().size.y); }