/* Список ответов: * 0 - все ок */ private IEnumerator Workflow(ProcessManager.Action Act) { Log.Notice(scrad, "Processing ..."); if (Act._WorkFlow._SetTargetBusy) { Act._Target.GetComponent <Basic>().Busy = true; } if (Act._WorkFlow._ActorGraphics != null) { GetComponent <Animator>().SetBool(Act._WorkFlow._ActorGraphics, true); } if (Act._Conditions.RequiredTool != ResourceTypeClassification.Resource) { Sack.Output(Resources.ResourceLibrary.Find(x => x.Classification == Act._Conditions.RequiredTool)); TakeTool(Resources.ResourceLibrary.Find(x => x.Classification == Act._Conditions.RequiredTool)); } float _SecondsPassed = 0; while (_SecondsPassed < Act._WorkFlow.SecondsToDo) { _SecondsPassed += Time.deltaTime; yield return(new WaitForEndOfFrame()); } if (Act._WorkFlow._SetTargetBusy) { Act._Target.GetComponent <Basic>().Busy = false; } if (Act._Conditions.RequiredTool != ResourceTypeClassification.Resource) { Sack.Input(Resources.ResourceLibrary.Find(x => x.Classification == Act._Conditions.RequiredTool), 1); TakeTool(null); } if (Act._WorkFlow._ActorGraphics != null) { GetComponent <Animator>().SetBool(Act._WorkFlow._ActorGraphics, false); } MakeEffects(Act); }
private ushort MakeEffects(ProcessManager.Action Act) { // Качаем скилл SkillImprove(Act.ID); // Накладываем синдром if (Act._Effects._SymptomForActor != 0) { Log.Notice(scrad, "There are no way to put an syndrom"); } // Удаляем цель if (Act._Effects._RemoveTarget) { Log.Notice(scrad, "Need to delete a target"); if (Act._Target.GetComponent <Brick>() != null) { Map.RemoveBrick(Act._Target.transform.position); } else { return(1); } } // Добавляем/убираем ресурсы при производстве if (Act._Effects._ResourcesToCreate.Count > 0) { foreach (ResourceEnumerator _r in Act._Effects._ResourcesToCreate) { switch (_r.PutIntoPointer) //2-Actor, 1-Target, 0-Landscape { case 2: Sack.Input(_r.Resource, _r.Count); break; case 1: Act._Effects._TargetSack.Input(_r.Resource, _r.Count); break; case 0: default: //кладем ресурс на землю break; } } } if (Act._Effects._NewBlockResourceType != null)//Убираем ресурсы при строительстве и строим блок { Act._Effects._TargetSack.Output(Act._Effects._NewBlockResourceType); if (Act._Effects._NewBlockParent == null) { Map.AddBrick(Act._Effects._NewBlockCoordinates, Act._Effects._NewBlockResourceType); } else { Map.AddBrick(Act._Effects._NewBlockCoordinates, Act._Effects._NewBlockResourceType).gameObject.transform.SetParent(Act._Effects._NewBlockParent.transform); } } Log.Notice(scra, "Action " + Act.ID + ". " + Act.Name + " of process #" + Act.ProcessID + " finished", gameObject); Busy = false; Links.Processes.StepDone(Act.ProcessID); return(0); }