//a method that sets the target building to construct locally public override void SetTargetLocal(Building newTarget) { if (newTarget == null || target == newTarget || newTarget.WorkerMgr.currWorkers >= newTarget.WorkerMgr.GetAvailableSlots()) //if the new target is invalid or it's already the builder's target { return; //do not proceed } Stop(); //stop constructing the current building //set new target inProgress = false; target = newTarget; gameMgr.MvtMgr.PrepareMove(unit, target.WorkerMgr.Add(unit), target.GetRadius(), target, InputMode.building, false); //move the unit towards the target building CustomEvents.OnUnitBuildingOrder(unit, target); //trigger custom event }