public static Entity BuildNakedMech(string label, bool player, Guidebook book) { var mech = new Entity(label: label, typeLabel: MechTypeLabel) .AddComponent(new Component_Buffable()) .AddComponent(new Component_ActionExecutor(Config.DefaultEntityAP)) .AddComponent(new Component_Skeleton()); if (player) { mech.AddComponent(new Component_Player()); mech.AddComponent(new Component_FocusUser()); } else if (book != null) { mech.AddComponent(new Component_AI(book)); } else { throw new InvalidOperationException("book can't be null!"); } SlotAt(mech, BodyPartLocation.LEFT_ARM, BlueprintListing.BuildForLabel(Blueprints.HAND)); SlotAt(mech, BodyPartLocation.RIGHT_ARM, BlueprintListing.BuildForLabel(Blueprints.HAND)); // Slot in all the required components return(mech); }
public Component_AI(Guidebook activeBook) { this.activeBook = activeBook; this.Scanned = false; this.Alerted = false; this.OnReturnLeg = false; }
public async Task <Response <string> > AddGuidebook(CreateGuidebookRequest request) { var guidebook = new Guidebook { Id = Guid.NewGuid().ToString(), Title = request.Title, GuidebookContent = request.GuidebookContent, ImageUrl = request.ImageURL, EstimatedFinishTime = request.EstimatedFinishTime, CreatedBy = request.CreatedBy, CreatedTime = DateTimeOffset.Now.ToOffset(new TimeSpan(7, 0, 0)).DateTime, LastModifiedBy = request.LastModifiedBy, LastModifiedTime = DateTimeOffset.Now.ToOffset(new TimeSpan(7, 0, 0)).DateTime, SuitableAge = request.SuitableAge, TypeId = request.TypeId, DelFlag = false, }; await _unitOfWork.GuidebookRepository.AddAsync(guidebook); await _unitOfWork.SaveAsync(); return(new Response <string>(guidebook.Id, $"Thêm guidebook thành công, id: {guidebook.Id}")); }