public DeployUnderConstructionBox ( Transform builtOver, Transform prefabToBuild, Vector3 position, float buildTime ) : void | ||
builtOver | Transform | Transform of the object where this Box is built. With this, we can pass a /// Resource back to a built extractor, for instance. We can call it as null |
prefabToBuild | Transform | Prefab to the building which will be built we te timer is over. |
position | Vector3 | A Vector3 with the position to create the box and instantiate the new building, /// if any |
buildTime | float | Time to build the building. When it's over, it will instantiate a new building, /// show the complete animation and will destroy itself |
return | void |
public void DeployUnderConstructionBox(Transform builtOver, Transform prefabToBuild,
Vector3 position, float buildTime)
{
// Create a new box
Transform myUnderConstructionBox = Instantiate(prefabUnderConstructionBox, position, Quaternion.identity)
as Transform;
UnderConstructionBox myUCBoxComponent =
myUnderConstructionBox.gameObject.GetComponent<UnderConstructionBox>();
// Set the prefab
myUCBoxComponent.SetPrefabToBuild(prefabToBuild);
// Set it's timer
myUCBoxComponent.SetBuildingTime(buildTime);
// Set the object where this will be built over
myUCBoxComponent.SetBuiltOverObject(builtOver);
}
MainScript::DeployUnderConstructionBox ( Vector3 position, float buildTime ) : void |