public override void BuildIt()
{
Transform prefabToBuild;
if(!mainScript) {
// DEBUG
Debug.LogError("MainScript not set!");
}
// In a resource site we can only build an extractor...
prefabToBuild = MainScript.Script.prefabExtractor;
CBuilding myBuildingClass = prefabToBuild.GetComponent<CBuilding>();
Deselect();
// Ok, first of all, let's check if we have the resources to actually build this
if(mainScript.CheckIfAreEnoughResourcesToBuild(prefabToBuild)) {
// With an extractor built, there's no need to be able to select this resource site anymore
Selectable = false;
// Charge the player!
mainScript.player.SubResourceMetal(myBuildingClass.costMetal);
mainScript.DeployUnderConstructionBox(this.transform,
prefabToBuild, transform.position, myBuildingClass.costTime);
// Tell the Quest Manager about this event
if(resourceType == eResourceType.Oxygen) {
mainScript.ReceiveNewEvent(this.transform, QuestManager.EQuestEvents.BUILT_OXYGEN_EXTRACTOR);
}
else {
mainScript.ReceiveNewEvent(this.transform, QuestManager.EQuestEvents.BUILT_METAL_EXTRACTOR);
}
}
}