public virtual void DestroyBuilding(bool cancelled = false) { if (smokeVFX) { smokeVFX.Play(); smokeVFX.transform.parent = null; } _Destroy = true; _BuildProgress = 0; _OrigPos = _BuildingObject.transform.position; if (TaskList.DoesTaskExist(_BuildTask)) { TaskList.RemoveTask(_BuildTask); } if (_Builder) { _Builder.CancelCurrentTask(); } _worldController._oreCount += Mathf.RoundToInt(cancelled ? _BuildCost : _BuildCost * .8f); if (_worldController.CheckStorage()) { _worldController._oreCount = _worldController._maxStorage - _worldController._energyCrystalsCount; } if (_worldController._oreCount < 0) { _worldController._oreCount = 0; } }