//public Workbench(Vector3 StartPoint, ushort TemplateType, byte Rotation, Structure ParentBuilding) //{ // //initialization // Master = new GameObject(); // //Bricks = new List<GameObject>(); // Sack = new Sack(Master); // Type = TemplateType; // WorkbenchTemplate Template = Workbenches.Templates.Find(x => x.Type == Type); // Name = Template.Name; // ID = Workbenches.WorkbenchID; // Master.transform.position = StartPoint; // Master.transform.SetParent(ParentBuilding.MasterObject.transform,true); // Master.name = Template.Name; // Master.tag = "WorkbenchBrick"; // foreach (WorkbenchElement _e in Template.Elements) // { // Vector3 _RotatedCoordinates = new Vector3(); // _RotatedCoordinates = _e.Coordinates; // for (byte i = 0; i < Rotation; i++) // _RotatedCoordinates = Functions.RightVector(_RotatedCoordinates); // GameObject _CurrentBrick = Links.Bricks.AddBrick(Functions.ObjectToWorldCoordinates(StartPoint + _RotatedCoordinates), _e.ResourceID, true); // //Bricks.Add(_CurrentBrick); // if (_e.BasicBrick) Base = _CurrentBrick; // _CurrentBrick.transform.SetParent(Master.transform, true); // _CurrentBrick.tag = "WorkbenchBrick"; // } //} public Workbench(PhantomConstruction Prototype, Structure ParentBuilding) { Master = new GameObject(); Sack = new Sack(Master); Base = Master; Type = Prototype.Type; Name = Prototype.TypeName; ID = Workbenches.WorkbenchID; Master.transform.position = Prototype.MasterObject.transform.position; Master.transform.SetParent(ParentBuilding.MasterObject.transform, true); Master.name = Prototype.TypeName; Master.tag = "WorkbenchBrick"; }
public Task <string> GetCodeAsync(Sack sack) { var task = Task.Factory.StartNew <string>(() => { var parts = sack.Shards .AsParallel() .AsOrdered() .Where(x => x.Active) .OrderBy(x => x.Chapter) .ThenBy(x => x.Order) .Select(x => x.PartialCode); return(string.Join(string.Empty, parts)); }); return(task); }
public IStat CreateStat( string statType ) { IStat stat = null; switch (statType) { case "Q": stat = new Sack(); break; case "Y": stat = new YardsRushing(); break; case "R": stat = new Carries(); break; case "C": stat = new Completions(); break; case "A": stat = new PassAttempts(); break; case "S": stat = new YardsPassing(); break; case "Z": stat = new PassesIntercepted(); break; case "P": stat = new PassesCaught(); break; case "G": stat = new YardsReceiving(); break; case "M": stat = new InterceptionsMade(); break; default: RosterLib.Utility.Announce( string.Format("A stat of type {0} cannot be found", statType ) ); break; } return stat; }
public ISack <T> Solve(IList <IItem <T> > items, long maxWeight) { var resultMatrix = new TwoDimensionalMatrix <long>(); var keepMatrix = new TwoDimensionalMatrix <bool>(); var itemCount = items.Count; for (var i = 1; i <= itemCount; i++) { var weightAtIndex = items[i - 1].Weight; var valueAtIndex = items[i - 1].Value; for (var w = 0; w <= maxWeight; w++) { var newValue = valueAtIndex + resultMatrix[i - 1, w - weightAtIndex]; var oldValue = resultMatrix[i - 1, w]; if (weightAtIndex <= w && newValue > oldValue) { resultMatrix[i, w] = newValue; keepMatrix[i, w] = true; } else { resultMatrix[i, w] = oldValue; } } } var defaultSack = new Sack <T>(maxWeight); var upperBound = maxWeight; for (var i = items.Count; i > 0; i--) { if (keepMatrix[i, upperBound]) { defaultSack.AddItem(items[i - 1]); upperBound -= items[i - 1].Weight; } } return(defaultSack); }
void Button_Click(object sender, RoutedEventArgs e) { if (!CheckInputData()) { return; } PrepareSetofItems(); var sack = new Sack(_W, SetOfItems); var brutalForce = new BrutalForceAlgorithm(sack); var greedy = new GreedyAlgorithm(sack); var dynamic = new DynamicAlgorithm(sack); ClearItems(); if (cbBF.IsChecked != null && cbBF.IsChecked.Value) { Compute(brutalForce); } Compute(greedy); Compute(dynamic); }
IList <Thing> processSensoryInformation() { IList <Thing> response = null; if (worldServer != null && worldServer.IsConnected) { response = worldServer.SendGetCreatureState(creatureName); prad = (Math.PI / 180) * response.First().Pitch; while (prad > Math.PI) { prad -= 2 * Math.PI; } while (prad < -Math.PI) { prad += 2 * Math.PI; } Sack s = worldServer.SendGetSack("0"); mind.setBag(s); } return(response); }
/* Список ответов: * 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); }
public bool DeepEquals(DestinyInventoryItemDefinition other) { return(other != null && Collectible.DeepEquals(other.Collectible) && SummaryItem.DeepEquals(other.SummaryItem) && ItemCategories.DeepEqualsReadOnlyCollections(other.ItemCategories) && AcquireRewardSiteHash == other.AcquireRewardSiteHash && AcquireUnlockHash == other.AcquireUnlockHash && AllowActions == other.AllowActions && (BackgroundColor != null ? BackgroundColor.DeepEquals(other.BackgroundColor) : other.BackgroundColor == null) && BreakerTypeEnumValue == other.BreakerTypeEnumValue && BreakerType.DeepEquals(other.BreakerType) && ClassType == other.ClassType && DefaultDamageTypeEnumValue == other.DefaultDamageTypeEnumValue && DefaultDamageType.DeepEquals(other.DefaultDamageType) && ItemSubType == other.ItemSubType && ItemType == other.ItemType && SpecialItemType == other.SpecialItemType && DisplayProperties.DeepEquals(other.DisplayProperties) && DisplaySource == other.DisplaySource && DoesPostmasterPullHaveSideEffects == other.DoesPostmasterPullHaveSideEffects && Equippable == other.Equippable && IconWatermark == other.IconWatermark && IconWatermarkShelved == other.IconWatermarkShelved && IsWrapper == other.IsWrapper && ItemTypeAndTierDisplayName == other.ItemTypeAndTierDisplayName && ItemTypeDisplayName == other.ItemTypeDisplayName && UiItemDisplayStyle == other.UiItemDisplayStyle && NonTransferrable == other.NonTransferrable && SecondaryIcon == other.SecondaryIcon && SecondaryOverlay == other.SecondaryOverlay && SecondarySpecial == other.SecondarySpecial && Screenshot == other.Screenshot && TooltipStyle == other.TooltipStyle && TraitIds.DeepEqualsReadOnlySimpleCollection(other.TraitIds) && (Stats != null ? Stats.DeepEquals(other.Stats) : other.Stats == null) && (TalentGrid != null ? TalentGrid.DeepEquals(other.TalentGrid) : other.TalentGrid == null) && (TranslationBlock != null ? TranslationBlock.DeepEquals(other.TranslationBlock) : other.TranslationBlock == null) && (Value != null ? Value.DeepEquals(other.Value) : other.Value == null) && (SetData != null ? SetData.DeepEquals(other.SetData) : other.SetData == null) && (Plug != null ? Plug.DeepEquals(other.Plug) : other.Plug == null) && (Preview != null ? Preview.DeepEquals(other.Preview) : other.Preview == null) && (Quality != null ? Quality.DeepEquals(other.Quality) : other.Quality == null) && (Objectives != null ? Objectives.DeepEquals(other.Objectives) : other.Objectives == null) && Inventory.DeepEquals(other.Inventory) && (Action != null ? Action.DeepEquals(other.Action) : other.Action == null) && (EquippingBlock != null ? EquippingBlock.DeepEquals(other.EquippingBlock) : other.EquippingBlock == null) && (Sockets != null ? Sockets.DeepEquals(other.Sockets) : other.Sockets == null) && InvestmentStats.DeepEqualsReadOnlyCollections(other.InvestmentStats) && Perks.DeepEqualsReadOnlyCollections(other.Perks) && TooltipNotifications.DeepEqualsReadOnlyCollections(other.TooltipNotifications) && (Sack != null ? Sack.DeepEquals(other.Sack) : other.Sack == null) && (Gearset != null ? Gearset.DeepEquals(other.Gearset) : other.Gearset == null) && EmblemObjective.DeepEquals(other.EmblemObjective) && (SourceData != null ? SourceData.DeepEquals(other.SourceData) : other.SourceData == null) && (Metrics != null ? Metrics.DeepEquals(other.Metrics) : other.Metrics == null) && (Summary != null ? Summary.DeepEquals(other.Summary) : other.Summary == null) && Lore.DeepEquals(other.Lore) && Animations.DeepEqualsReadOnlyCollections(other.Animations) && Links.DeepEqualsReadOnlyCollections(other.Links) && DamageTypes.DeepEqualsReadOnlyCollections(other.DamageTypes) && DamageTypeEnumValues.DeepEqualsReadOnlySimpleCollection(other.DamageTypeEnumValues) && Season.DeepEquals(other.Season) && Blacklisted == other.Blacklisted && Hash == other.Hash && Index == other.Index && Redacted == other.Redacted); }
public Storage(Vector3 StorageStartPoint, Vector3 StorageEndPoint) : base(1, StorageStartPoint, StorageEndPoint) { StorageSack = new Sack(this.GetTarget(), 1); }
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); }
public bool DeepEquals(DestinyInventoryItemDefinition?other) { return(other is not null && (DisplayProperties is not null ? DisplayProperties.DeepEquals(other.DisplayProperties) : other.DisplayProperties is null) && TooltipNotifications.DeepEqualsList(other.TooltipNotifications) && CollectibleHash == other.CollectibleHash && IconWatermark == other.IconWatermark && IconWatermarkShelved == other.IconWatermarkShelved && SecondaryIcon == other.SecondaryIcon && SecondaryOverlay == other.SecondaryOverlay && SecondarySpecial == other.SecondarySpecial && (BackgroundColor is not null ? BackgroundColor.DeepEquals(other.BackgroundColor) : other.BackgroundColor is null) && Screenshot == other.Screenshot && ItemTypeDisplayName == other.ItemTypeDisplayName && FlavorText == other.FlavorText && UiItemDisplayStyle == other.UiItemDisplayStyle && ItemTypeAndTierDisplayName == other.ItemTypeAndTierDisplayName && DisplaySource == other.DisplaySource && TooltipStyle == other.TooltipStyle && (Action is not null ? Action.DeepEquals(other.Action) : other.Action is null) && (Inventory is not null ? Inventory.DeepEquals(other.Inventory) : other.Inventory is null) && (SetData is not null ? SetData.DeepEquals(other.SetData) : other.SetData is null) && (Stats is not null ? Stats.DeepEquals(other.Stats) : other.Stats is null) && EmblemObjectiveHash == other.EmblemObjectiveHash && (EquippingBlock is not null ? EquippingBlock.DeepEquals(other.EquippingBlock) : other.EquippingBlock is null) && (TranslationBlock is not null ? TranslationBlock.DeepEquals(other.TranslationBlock) : other.TranslationBlock is null) && (Preview is not null ? Preview.DeepEquals(other.Preview) : other.Preview is null) && (Quality is not null ? Quality.DeepEquals(other.Quality) : other.Quality is null) && (Value is not null ? Value.DeepEquals(other.Value) : other.Value is null) && (SourceData is not null ? SourceData.DeepEquals(other.SourceData) : other.SourceData is null) && (Objectives is not null ? Objectives.DeepEquals(other.Objectives) : other.Objectives is null) && (Metrics is not null ? Metrics.DeepEquals(other.Metrics) : other.Metrics is null) && (Plug is not null ? Plug.DeepEquals(other.Plug) : other.Plug is null) && (Gearset is not null ? Gearset.DeepEquals(other.Gearset) : other.Gearset is null) && (Sack is not null ? Sack.DeepEquals(other.Sack) : other.Sack is null) && (Sockets is not null ? Sockets.DeepEquals(other.Sockets) : other.Sockets is null) && (Summary is not null ? Summary.DeepEquals(other.Summary) : other.Summary is null) && (TalentGrid is not null ? TalentGrid.DeepEquals(other.TalentGrid) : other.TalentGrid is null) && InvestmentStats.DeepEqualsList(other.InvestmentStats) && Perks.DeepEqualsList(other.Perks) && LoreHash == other.LoreHash && SummaryItemHash == other.SummaryItemHash && Animations.DeepEqualsList(other.Animations) && AllowActions == other.AllowActions && Links.DeepEqualsList(other.Links) && DoesPostmasterPullHaveSideEffects == other.DoesPostmasterPullHaveSideEffects && NonTransferrable == other.NonTransferrable && ItemCategoryHashes.DeepEqualsListNaive(other.ItemCategoryHashes) && SpecialItemType == other.SpecialItemType && ItemType == other.ItemType && ItemSubType == other.ItemSubType && ClassType == other.ClassType && BreakerType == other.BreakerType && BreakerTypeHash == other.BreakerTypeHash && Equippable == other.Equippable && DamageTypeHashes.DeepEqualsListNaive(other.DamageTypeHashes) && DamageTypes.DeepEqualsListNaive(other.DamageTypes) && DefaultDamageType == other.DefaultDamageType && DefaultDamageTypeHash == other.DefaultDamageTypeHash && SeasonHash == other.SeasonHash && IsWrapper == other.IsWrapper && TraitIds.DeepEqualsListNaive(other.TraitIds) && TraitHashes.DeepEqualsListNaive(other.TraitHashes) && Hash == other.Hash && Index == other.Index && Redacted == other.Redacted); }
public DynamicAlgorithm(Sack sack) : base(sack) { _a = new int[_sack.ItemsQuantity + 1, _sack.Capacity + 1]; _keepTable = new int[_sack.ItemsQuantity + 1, _sack.Capacity + 1]; }
public void ShowSack(Sack Content) { StartCoroutine(_ShowSack(Content)); }
public void Update(DestinyInventoryItemDefinition?other) { if (other is null) { return; } if (!DisplayProperties.DeepEquals(other.DisplayProperties)) { DisplayProperties.Update(other.DisplayProperties); OnPropertyChanged(nameof(DisplayProperties)); } if (!TooltipNotifications.DeepEqualsList(other.TooltipNotifications)) { TooltipNotifications = other.TooltipNotifications; OnPropertyChanged(nameof(TooltipNotifications)); } if (CollectibleHash != other.CollectibleHash) { CollectibleHash = other.CollectibleHash; OnPropertyChanged(nameof(CollectibleHash)); } if (IconWatermark != other.IconWatermark) { IconWatermark = other.IconWatermark; OnPropertyChanged(nameof(IconWatermark)); } if (IconWatermarkShelved != other.IconWatermarkShelved) { IconWatermarkShelved = other.IconWatermarkShelved; OnPropertyChanged(nameof(IconWatermarkShelved)); } if (SecondaryIcon != other.SecondaryIcon) { SecondaryIcon = other.SecondaryIcon; OnPropertyChanged(nameof(SecondaryIcon)); } if (SecondaryOverlay != other.SecondaryOverlay) { SecondaryOverlay = other.SecondaryOverlay; OnPropertyChanged(nameof(SecondaryOverlay)); } if (SecondarySpecial != other.SecondarySpecial) { SecondarySpecial = other.SecondarySpecial; OnPropertyChanged(nameof(SecondarySpecial)); } if (!BackgroundColor.DeepEquals(other.BackgroundColor)) { BackgroundColor.Update(other.BackgroundColor); OnPropertyChanged(nameof(BackgroundColor)); } if (Screenshot != other.Screenshot) { Screenshot = other.Screenshot; OnPropertyChanged(nameof(Screenshot)); } if (ItemTypeDisplayName != other.ItemTypeDisplayName) { ItemTypeDisplayName = other.ItemTypeDisplayName; OnPropertyChanged(nameof(ItemTypeDisplayName)); } if (FlavorText != other.FlavorText) { FlavorText = other.FlavorText; OnPropertyChanged(nameof(FlavorText)); } if (UiItemDisplayStyle != other.UiItemDisplayStyle) { UiItemDisplayStyle = other.UiItemDisplayStyle; OnPropertyChanged(nameof(UiItemDisplayStyle)); } if (ItemTypeAndTierDisplayName != other.ItemTypeAndTierDisplayName) { ItemTypeAndTierDisplayName = other.ItemTypeAndTierDisplayName; OnPropertyChanged(nameof(ItemTypeAndTierDisplayName)); } if (DisplaySource != other.DisplaySource) { DisplaySource = other.DisplaySource; OnPropertyChanged(nameof(DisplaySource)); } if (TooltipStyle != other.TooltipStyle) { TooltipStyle = other.TooltipStyle; OnPropertyChanged(nameof(TooltipStyle)); } if (!Action.DeepEquals(other.Action)) { Action.Update(other.Action); OnPropertyChanged(nameof(Action)); } if (!Inventory.DeepEquals(other.Inventory)) { Inventory.Update(other.Inventory); OnPropertyChanged(nameof(Inventory)); } if (!SetData.DeepEquals(other.SetData)) { SetData.Update(other.SetData); OnPropertyChanged(nameof(SetData)); } if (!Stats.DeepEquals(other.Stats)) { Stats.Update(other.Stats); OnPropertyChanged(nameof(Stats)); } if (EmblemObjectiveHash != other.EmblemObjectiveHash) { EmblemObjectiveHash = other.EmblemObjectiveHash; OnPropertyChanged(nameof(EmblemObjectiveHash)); } if (!EquippingBlock.DeepEquals(other.EquippingBlock)) { EquippingBlock.Update(other.EquippingBlock); OnPropertyChanged(nameof(EquippingBlock)); } if (!TranslationBlock.DeepEquals(other.TranslationBlock)) { TranslationBlock.Update(other.TranslationBlock); OnPropertyChanged(nameof(TranslationBlock)); } if (!Preview.DeepEquals(other.Preview)) { Preview.Update(other.Preview); OnPropertyChanged(nameof(Preview)); } if (!Quality.DeepEquals(other.Quality)) { Quality.Update(other.Quality); OnPropertyChanged(nameof(Quality)); } if (!Value.DeepEquals(other.Value)) { Value.Update(other.Value); OnPropertyChanged(nameof(Value)); } if (!SourceData.DeepEquals(other.SourceData)) { SourceData.Update(other.SourceData); OnPropertyChanged(nameof(SourceData)); } if (!Objectives.DeepEquals(other.Objectives)) { Objectives.Update(other.Objectives); OnPropertyChanged(nameof(Objectives)); } if (!Metrics.DeepEquals(other.Metrics)) { Metrics.Update(other.Metrics); OnPropertyChanged(nameof(Metrics)); } if (!Plug.DeepEquals(other.Plug)) { Plug.Update(other.Plug); OnPropertyChanged(nameof(Plug)); } if (!Gearset.DeepEquals(other.Gearset)) { Gearset.Update(other.Gearset); OnPropertyChanged(nameof(Gearset)); } if (!Sack.DeepEquals(other.Sack)) { Sack.Update(other.Sack); OnPropertyChanged(nameof(Sack)); } if (!Sockets.DeepEquals(other.Sockets)) { Sockets.Update(other.Sockets); OnPropertyChanged(nameof(Sockets)); } if (!Summary.DeepEquals(other.Summary)) { Summary.Update(other.Summary); OnPropertyChanged(nameof(Summary)); } if (!TalentGrid.DeepEquals(other.TalentGrid)) { TalentGrid.Update(other.TalentGrid); OnPropertyChanged(nameof(TalentGrid)); } if (!InvestmentStats.DeepEqualsList(other.InvestmentStats)) { InvestmentStats = other.InvestmentStats; OnPropertyChanged(nameof(InvestmentStats)); } if (!Perks.DeepEqualsList(other.Perks)) { Perks = other.Perks; OnPropertyChanged(nameof(Perks)); } if (LoreHash != other.LoreHash) { LoreHash = other.LoreHash; OnPropertyChanged(nameof(LoreHash)); } if (SummaryItemHash != other.SummaryItemHash) { SummaryItemHash = other.SummaryItemHash; OnPropertyChanged(nameof(SummaryItemHash)); } if (!Animations.DeepEqualsList(other.Animations)) { Animations = other.Animations; OnPropertyChanged(nameof(Animations)); } if (AllowActions != other.AllowActions) { AllowActions = other.AllowActions; OnPropertyChanged(nameof(AllowActions)); } if (!Links.DeepEqualsList(other.Links)) { Links = other.Links; OnPropertyChanged(nameof(Links)); } if (DoesPostmasterPullHaveSideEffects != other.DoesPostmasterPullHaveSideEffects) { DoesPostmasterPullHaveSideEffects = other.DoesPostmasterPullHaveSideEffects; OnPropertyChanged(nameof(DoesPostmasterPullHaveSideEffects)); } if (NonTransferrable != other.NonTransferrable) { NonTransferrable = other.NonTransferrable; OnPropertyChanged(nameof(NonTransferrable)); } if (!ItemCategoryHashes.DeepEqualsListNaive(other.ItemCategoryHashes)) { ItemCategoryHashes = other.ItemCategoryHashes; OnPropertyChanged(nameof(ItemCategoryHashes)); } if (SpecialItemType != other.SpecialItemType) { SpecialItemType = other.SpecialItemType; OnPropertyChanged(nameof(SpecialItemType)); } if (ItemType != other.ItemType) { ItemType = other.ItemType; OnPropertyChanged(nameof(ItemType)); } if (ItemSubType != other.ItemSubType) { ItemSubType = other.ItemSubType; OnPropertyChanged(nameof(ItemSubType)); } if (ClassType != other.ClassType) { ClassType = other.ClassType; OnPropertyChanged(nameof(ClassType)); } if (BreakerType != other.BreakerType) { BreakerType = other.BreakerType; OnPropertyChanged(nameof(BreakerType)); } if (BreakerTypeHash != other.BreakerTypeHash) { BreakerTypeHash = other.BreakerTypeHash; OnPropertyChanged(nameof(BreakerTypeHash)); } if (Equippable != other.Equippable) { Equippable = other.Equippable; OnPropertyChanged(nameof(Equippable)); } if (!DamageTypeHashes.DeepEqualsListNaive(other.DamageTypeHashes)) { DamageTypeHashes = other.DamageTypeHashes; OnPropertyChanged(nameof(DamageTypeHashes)); } if (!DamageTypes.DeepEqualsListNaive(other.DamageTypes)) { DamageTypes = other.DamageTypes; OnPropertyChanged(nameof(DamageTypes)); } if (DefaultDamageType != other.DefaultDamageType) { DefaultDamageType = other.DefaultDamageType; OnPropertyChanged(nameof(DefaultDamageType)); } if (DefaultDamageTypeHash != other.DefaultDamageTypeHash) { DefaultDamageTypeHash = other.DefaultDamageTypeHash; OnPropertyChanged(nameof(DefaultDamageTypeHash)); } if (SeasonHash != other.SeasonHash) { SeasonHash = other.SeasonHash; OnPropertyChanged(nameof(SeasonHash)); } if (IsWrapper != other.IsWrapper) { IsWrapper = other.IsWrapper; OnPropertyChanged(nameof(IsWrapper)); } if (!TraitIds.DeepEqualsListNaive(other.TraitIds)) { TraitIds = other.TraitIds; OnPropertyChanged(nameof(TraitIds)); } if (!TraitHashes.DeepEqualsListNaive(other.TraitHashes)) { TraitHashes = other.TraitHashes; OnPropertyChanged(nameof(TraitHashes)); } if (Hash != other.Hash) { Hash = other.Hash; OnPropertyChanged(nameof(Hash)); } if (Index != other.Index) { Index = other.Index; OnPropertyChanged(nameof(Index)); } if (Redacted != other.Redacted) { Redacted = other.Redacted; OnPropertyChanged(nameof(Redacted)); } }
public TestHttpClient(Sack expectedSack) { sack = expectedSack; }
public GreedyAlgorithm(Sack sack) : base(sack) { _currentWeight = 0; }
public bool Equals(DestinyInventoryItemDefinition input) { if (input == null) { return(false); } return (( DisplayProperties == input.DisplayProperties || (DisplayProperties != null && DisplayProperties.Equals(input.DisplayProperties)) ) && ( TooltipNotifications == input.TooltipNotifications || (TooltipNotifications != null && TooltipNotifications.SequenceEqual(input.TooltipNotifications)) ) && ( CollectibleHash == input.CollectibleHash || (CollectibleHash.Equals(input.CollectibleHash)) ) && ( IconWatermark == input.IconWatermark || (IconWatermark != null && IconWatermark.Equals(input.IconWatermark)) ) && ( IconWatermarkShelved == input.IconWatermarkShelved || (IconWatermarkShelved != null && IconWatermarkShelved.Equals(input.IconWatermarkShelved)) ) && ( SecondaryIcon == input.SecondaryIcon || (SecondaryIcon != null && SecondaryIcon.Equals(input.SecondaryIcon)) ) && ( SecondaryOverlay == input.SecondaryOverlay || (SecondaryOverlay != null && SecondaryOverlay.Equals(input.SecondaryOverlay)) ) && ( SecondarySpecial == input.SecondarySpecial || (SecondarySpecial != null && SecondarySpecial.Equals(input.SecondarySpecial)) ) && ( BackgroundColor == input.BackgroundColor || (BackgroundColor != null && BackgroundColor.Equals(input.BackgroundColor)) ) && ( Screenshot == input.Screenshot || (Screenshot != null && Screenshot.Equals(input.Screenshot)) ) && ( ItemTypeDisplayName == input.ItemTypeDisplayName || (ItemTypeDisplayName != null && ItemTypeDisplayName.Equals(input.ItemTypeDisplayName)) ) && ( FlavorText == input.FlavorText || (FlavorText != null && FlavorText.Equals(input.FlavorText)) ) && ( UiItemDisplayStyle == input.UiItemDisplayStyle || (UiItemDisplayStyle != null && UiItemDisplayStyle.Equals(input.UiItemDisplayStyle)) ) && ( ItemTypeAndTierDisplayName == input.ItemTypeAndTierDisplayName || (ItemTypeAndTierDisplayName != null && ItemTypeAndTierDisplayName.Equals(input.ItemTypeAndTierDisplayName)) ) && ( DisplaySource == input.DisplaySource || (DisplaySource != null && DisplaySource.Equals(input.DisplaySource)) ) && ( TooltipStyle == input.TooltipStyle || (TooltipStyle != null && TooltipStyle.Equals(input.TooltipStyle)) ) && ( Action == input.Action || (Action != null && Action.Equals(input.Action)) ) && ( Inventory == input.Inventory || (Inventory != null && Inventory.Equals(input.Inventory)) ) && ( SetData == input.SetData || (SetData != null && SetData.Equals(input.SetData)) ) && ( Stats == input.Stats || (Stats != null && Stats.Equals(input.Stats)) ) && ( EmblemObjectiveHash == input.EmblemObjectiveHash || (EmblemObjectiveHash.Equals(input.EmblemObjectiveHash)) ) && ( EquippingBlock == input.EquippingBlock || (EquippingBlock != null && EquippingBlock.Equals(input.EquippingBlock)) ) && ( TranslationBlock == input.TranslationBlock || (TranslationBlock != null && TranslationBlock.Equals(input.TranslationBlock)) ) && ( Preview == input.Preview || (Preview != null && Preview.Equals(input.Preview)) ) && ( Quality == input.Quality || (Quality != null && Quality.Equals(input.Quality)) ) && ( Value == input.Value || (Value != null && Value.Equals(input.Value)) ) && ( SourceData == input.SourceData || (SourceData != null && SourceData.Equals(input.SourceData)) ) && ( Objectives == input.Objectives || (Objectives != null && Objectives.Equals(input.Objectives)) ) && ( Metrics == input.Metrics || (Metrics != null && Metrics.Equals(input.Metrics)) ) && ( Plug == input.Plug || (Plug != null && Plug.Equals(input.Plug)) ) && ( Gearset == input.Gearset || (Gearset != null && Gearset.Equals(input.Gearset)) ) && ( Sack == input.Sack || (Sack != null && Sack.Equals(input.Sack)) ) && ( Sockets == input.Sockets || (Sockets != null && Sockets.Equals(input.Sockets)) ) && ( Summary == input.Summary || (Summary != null && Summary.Equals(input.Summary)) ) && ( TalentGrid == input.TalentGrid || (TalentGrid != null && TalentGrid.Equals(input.TalentGrid)) ) && ( InvestmentStats == input.InvestmentStats || (InvestmentStats != null && InvestmentStats.SequenceEqual(input.InvestmentStats)) ) && ( Perks == input.Perks || (Perks != null && Perks.SequenceEqual(input.Perks)) ) && ( LoreHash == input.LoreHash || (LoreHash.Equals(input.LoreHash)) ) && ( SummaryItemHash == input.SummaryItemHash || (SummaryItemHash.Equals(input.SummaryItemHash)) ) && ( Animations == input.Animations || (Animations != null && Animations.SequenceEqual(input.Animations)) ) && ( AllowActions == input.AllowActions || (AllowActions != null && AllowActions.Equals(input.AllowActions)) ) && ( Links == input.Links || (Links != null && Links.SequenceEqual(input.Links)) ) && ( DoesPostmasterPullHaveSideEffects == input.DoesPostmasterPullHaveSideEffects || (DoesPostmasterPullHaveSideEffects != null && DoesPostmasterPullHaveSideEffects.Equals(input.DoesPostmasterPullHaveSideEffects)) ) && ( NonTransferrable == input.NonTransferrable || (NonTransferrable != null && NonTransferrable.Equals(input.NonTransferrable)) ) && ( ItemCategoryHashes == input.ItemCategoryHashes || (ItemCategoryHashes != null && ItemCategoryHashes.SequenceEqual(input.ItemCategoryHashes)) ) && ( SpecialItemType == input.SpecialItemType || (SpecialItemType != null && SpecialItemType.Equals(input.SpecialItemType)) ) && ( ItemType == input.ItemType || (ItemType != null && ItemType.Equals(input.ItemType)) ) && ( ItemSubType == input.ItemSubType || (ItemSubType != null && ItemSubType.Equals(input.ItemSubType)) ) && ( ClassType == input.ClassType || (ClassType != null && ClassType.Equals(input.ClassType)) ) && ( BreakerType == input.BreakerType || (BreakerType != null && BreakerType.Equals(input.BreakerType)) ) && ( BreakerTypeHash == input.BreakerTypeHash || (BreakerTypeHash.Equals(input.BreakerTypeHash)) ) && ( Equippable == input.Equippable || (Equippable != null && Equippable.Equals(input.Equippable)) ) && ( DamageTypeHashes == input.DamageTypeHashes || (DamageTypeHashes != null && DamageTypeHashes.SequenceEqual(input.DamageTypeHashes)) ) && ( DamageTypes == input.DamageTypes || (DamageTypes != null && DamageTypes.SequenceEqual(input.DamageTypes)) ) && ( DefaultDamageType == input.DefaultDamageType || (DefaultDamageType != null && DefaultDamageType.Equals(input.DefaultDamageType)) ) && ( DefaultDamageTypeHash == input.DefaultDamageTypeHash || (DefaultDamageTypeHash.Equals(input.DefaultDamageTypeHash)) ) && ( SeasonHash == input.SeasonHash || (SeasonHash.Equals(input.SeasonHash)) ) && ( IsWrapper == input.IsWrapper || (IsWrapper != null && IsWrapper.Equals(input.IsWrapper)) ) && ( TraitIds == input.TraitIds || (TraitIds != null && TraitIds.SequenceEqual(input.TraitIds)) ) && ( TraitHashes == input.TraitHashes || (TraitHashes != null && TraitHashes.SequenceEqual(input.TraitHashes)) ) && ( Hash == input.Hash || (Hash.Equals(input.Hash)) ) && ( Index == input.Index || (Index.Equals(input.Index)) ) && ( Redacted == input.Redacted || (Redacted != null && Redacted.Equals(input.Redacted)) )); }
/// <summary> /// Make the agent perception. In other words, translate the information that came from sensors to a new type that the agent can understand /// </summary> /// <param name="sensorialInformation">The information that came from server</param> /// <returns>The perceived information</returns> private SensoryInformation prepareSensoryInformation(IList <Thing> listOfThings) { // New sensory information SensoryInformation si = World.NewSensoryInformation(CurrentAgent); int targetRed, targetGreen, targetBlue, targetYellow, targetMagenta, targetWhite; Creature c = (Creature)listOfThings.Where(item => (item.CategoryId == Thing.CATEGORY_CREATURE)).First(); Sack s = updateSackAndTarget(listOfThings, c, out targetRed, out targetGreen, out targetBlue, out targetYellow, out targetMagenta, out targetWhite); // Set up initial activation levels. double wallAheadActivationValue = MIN_ACT_VAL; double jewelAheadActivationValue = MIN_ACT_VAL; double foodAheadActivationValue = MIN_ACT_VAL; double jewelAwayActivationValue = MIN_ACT_VAL; double foodAwayActivationValue = MIN_ACT_VAL; double allJewelsCollectedActivationValue = MIN_ACT_VAL; double creatureCanDeliverActivationValue = MIN_ACT_VAL; // Loop through the list of things in the environment. // First, handle close objects. foreach (Thing thing in listOfThings) { // Thing is close to the creature, so change activation values accordingly. int categoryId = thing.CategoryId; if (thing.DistanceToCreature <= 50 && categoryId != Thing.CATEGORY_CREATURE) { switch (categoryId) { case Thing.CATEGORY_BRICK: wallAheadActivationValue = WALL_AHEAD_ACT_VAL; break; case Thing.CATEGORY_JEWEL: jewelAheadActivationValue = JEWEL_AHEAD_ACT_VAL; jewelToGet = thing; break; case Thing.categoryPFOOD: case Thing.CATEGORY_NPFOOD: case Thing.CATEGORY_FOOD: foodAheadActivationValue = FOOD_AHEAD_ACT_VAL; foodToGet = thing; break; default: break; } } } // Look now for the closest jewel to go to. IEnumerable <Thing> jewels = listOfThings.Where(item => (item.CategoryId == Thing.CATEGORY_JEWEL && item.DistanceToCreature > 50)); if (jewels.Any()) { IEnumerable <Thing> orderedJewels = jewels.OrderBy(item => item.DistanceToCreature); Boolean foundJewel = false; foreach (Thing jewel in orderedJewels) { // Check if the jewel is required, otherwise skip. if ((jewel.Material.Color.Equals("Red") && targetRed > 0) || (jewel.Material.Color.Equals("Green") && targetGreen > 0) || (jewel.Material.Color.Equals("Blue") && targetBlue > 0) || (jewel.Material.Color.Equals("Yellow") && targetYellow > 0) || (jewel.Material.Color.Equals("Magenta") && targetMagenta > 0) || (jewel.Material.Color.Equals("White") && targetWhite > 0)) { jewelAwayActivationValue = JEWEL_AWAY_ACT_VAL; jewelToGoTo = jewel; // Found one jewel as target, no need to keep looking. Console.WriteLine("Jewel to go to: " + jewel.Name); Console.WriteLine("Jewel color: " + jewel.Material.Color); break; } } if (!foundJewel && !GlobalVars.competitionMode) { Console.WriteLine("No more jewels to collect!!!"); Console.WriteLine("targetRed = " + targetRed); Console.WriteLine("targetGreen = " + targetGreen); Console.WriteLine("targetBlue = " + targetBlue); Console.WriteLine("targetYellow = " + targetYellow); Console.WriteLine("targetMagenta = " + targetMagenta); Console.WriteLine("targetWhite = " + targetWhite); } } // Verify if all collection of jewels is done. if (targetRed <= 0 && targetGreen <= 0 && targetBlue <= 0 && targetYellow <= 0 && targetMagenta <= 0 && targetWhite <= 0) { allJewelsCollectedActivationValue = ALL_JEWELS_COLLECTED_ACT_VAL; Console.WriteLine("Go to delivery, all items collected"); } // And the closest food to go to, if required. IEnumerable <Thing> foods = listOfThings.Where(item => (item.CategoryId == Thing.categoryPFOOD || item.CategoryId == Thing.CATEGORY_FOOD || item.CategoryId == Thing.CATEGORY_NPFOOD && item.DistanceToCreature > 50)); if (foods.Any() && c.Fuel < 400) { foodAwayActivationValue = FOOD_AWAY_ACT_VAL; foodToGoTo = foods.OrderBy(item => item.DistanceToCreature).First(); Console.WriteLine("Food to go to: " + foodToGoTo.Name); } // Check if at the delivery spot with jewels to deliver and set activation for delivery. if (c.X1 == 0 && c.X2 == 0 && s != null && ((s.red_crystal >= 0) || (s.green_crystal >= 0) || (s.blue_crystal >= 0) || (s.yellow_crystal >= 0) || (s.magenta_crystal >= 0) || (s.white_crystal >= 0))) { creatureCanDeliverActivationValue = CREATURE_CAN_DELIVER_ACT_VAL; Console.WriteLine("Creature can deliver jewels"); } // Set up activation levels. si.Add(inputWallAhead, wallAheadActivationValue); si.Add(inputJewelAhead, jewelAheadActivationValue); si.Add(inputFoodAhead, foodAheadActivationValue); si.Add(inputJewelAway, jewelAwayActivationValue); si.Add(inputFoodAway, foodAwayActivationValue); si.Add(inputAllJewelsCollected, allJewelsCollectedActivationValue); si.Add(inputCreatureCanDeliver, creatureCanDeliverActivationValue); return(si); }
public BrutalForceAlgorithm(Sack sack) : base(sack) { _bestValue = 0; }
private void SetSack(Sack expectedSack) { expectedSack.Shards.Add(new Shard() { Order = 1, Chapter = 2, PartialCode = "o", Active = false }); expectedSack.Shards.Add(new Shard() { Order = 4, Chapter = 3, PartialCode = "6", Active = true }); expectedSack.Shards.Add(new Shard() { Order = 1, Chapter = 3, PartialCode = "t", Active = true }); expectedSack.Shards.Add(new Shard() { Order = 6, Chapter = 3, PartialCode = "4", Active = true }); expectedSack.Shards.Add(new Shard() { Order = 4, Chapter = 1, PartialCode = "l", Active = false }); expectedSack.Shards.Add(new Shard() { Order = 1, Chapter = 2, PartialCode = "d", Active = true }); expectedSack.Shards.Add(new Shard() { Order = 2, Chapter = 3, PartialCode = "1", Active = true }); expectedSack.Shards.Add(new Shard() { Order = 1, Chapter = 1, PartialCode = "7", Active = false }); expectedSack.Shards.Add(new Shard() { Order = 1, Chapter = 4, PartialCode = "0", Active = false }); expectedSack.Shards.Add(new Shard() { Order = 4, Chapter = 1, PartialCode = "4", Active = false }); expectedSack.Shards.Add(new Shard() { Order = 5, Chapter = 3, PartialCode = "h", Active = true }); expectedSack.Shards.Add(new Shard() { Order = 2, Chapter = 3, PartialCode = "u", Active = false }); expectedSack.Shards.Add(new Shard() { Order = 1, Chapter = 1, PartialCode = "e", Active = false }); expectedSack.Shards.Add(new Shard() { Order = 2, Chapter = 2, PartialCode = "9", Active = true }); expectedSack.Shards.Add(new Shard() { Order = 7, Chapter = 2, PartialCode = "d", Active = false }); expectedSack.Shards.Add(new Shard() { Order = 1, Chapter = 3, PartialCode = "8", Active = false }); expectedSack.Shards.Add(new Shard() { Order = 2, Chapter = 2, PartialCode = "r", Active = false }); expectedSack.Shards.Add(new Shard() { Order = 3, Chapter = 3, PartialCode = "a", Active = true }); expectedSack.Shards.Add(new Shard() { Order = 1, Chapter = 4, PartialCode = "b", Active = true }); expectedSack.Shards.Add(new Shard() { Order = 6, Chapter = 2, PartialCode = "x", Active = false }); expectedSack.Shards.Add(new Shard() { Order = 1, Chapter = 5, PartialCode = "9", Active = true }); expectedSack.Shards.Add(new Shard() { Order = 1, Chapter = 4, PartialCode = "d", Active = false }); }
void OnEnable() { InvokeRepeating ("GenerateEnemies", spawnInterval, spawnInterval); enemySack = gameObject.GetComponent<Sack> (); }
// Любимые действия для отдыха пока не заводил. Заведу на более поздних этапах void Start() { _Skills = new List <Skill>(); Sack = new Sack(gameObject); CurrentProcessID = -1; }
protected KnapsackAlgorithm(Sack sack) { _theBestItems = new List <SackItem>(); _sack = sack; }
private ushort CheckPossibility(ProcessManager.Action Act) { Log.Notice(scra, "Action possibility checking started"); bool _CheckPassed = false; //Проверка на наличие нужной цели if ((Act._Target == null) && (Act._Conditions._ReqiuredTargets.Count > 0)) { return(2); } if (Act._Conditions._ReqiuredTargets.Count > 0) { foreach (string _s in Act._Conditions._ReqiuredTargets) { if (_s == Act._Target.tag) { _CheckPassed = true; } } if (!_CheckPassed) { return(3); } } // Проверка на расстояние до цели if (Act._Conditions._ReqiuredTargets.Count > 0) { if (Vector3.Distance(GetComponent <Transform>().position, Act._Target.transform.position) < Act._Conditions._MinDistanceToTarget) { return(4); } if (Vector3.Distance(GetComponent <Transform>().position, Act._Target.transform.position) > Act._Conditions._MaxDistanceToTarget) { return(5); } } // Проверка на наличие нужных ресурсов у цели if (Act._Effects._ResourcesToCreate.FindAll(x => (x.PutIntoPointer == 1) && (x.Count < 0)).Count > 0) { if (Act._Target.GetComponent <Unit>() == null && Act._Effects._TargetSack == null) { Log.Notice(scrad, "Target's sack content:"); Act._Effects._TargetSack.LogAllSack(); return(6); } if (Act._Effects._TargetSack == null) { Act._Effects._TargetSack = Act._Target.GetComponent <Unit>().Sack; } foreach (ResourceEnumerator _r in Act._Effects._ResourcesToCreate.FindAll(x => (x.PutIntoPointer == 1) && (x.Count < 0))) { if (!Act._Effects._TargetSack.HasAResource(_r.Resource, _r.Count)) { return(7); } } } // Проверка на наличие нужных ресурсов у действующего if (Act._Effects._ResourcesToCreate.FindAll(x => (x.PutIntoPointer == 2) && (x.Count < 0)).Count > 0)//Создаваемые ресурсы присутсвуют { foreach (ResourceEnumerator _r in Act._Effects._ResourcesToCreate.FindAll(x => (x.PutIntoPointer == 2) && (x.Count < 0))) { if (!Sack.HasAResource(_r.Resource, _r.Count)) { return(9); } } } if (Act._Effects._NewBlockResourceType != null)//Ресурсы для строительства блока присутсвуют { if (!Act._Effects._TargetSack.HasAResource(Act._Effects._NewBlockResourceType)) { return(7); } } /// Проверка на наличие свободного места у цели if (Act._Effects._ResourcesToCreate.FindAll(x => (x.PutIntoPointer == 1) && (x.Count > 0)).Count > 0) { if (Act._Target.GetComponent <Unit>() == null && !Act._Effects._TargetSack.Exists()) { Log.Notice(scrad, "First condition: " + (Act._Target.GetComponent <Unit>().Sack == null) + " Second condition: " + (!Act._Effects._TargetSack.Exists())); Log.Notice(scrad, "Target's sack content:"); Act._Effects._TargetSack.LogAllSack(); return(6); } if (!Act._Effects._TargetSack.Exists()) { Act._Effects._TargetSack = Act._Target.GetComponent <Unit>().Sack; } if (!Sack.HasEnoughSpaceFor(Act._Effects._ResourcesToCreate.FindAll(x => (x.PutIntoPointer == 1) && (x.Count > 0)))) { return(10); } } // Проверка на наличие свободного места у актера if (Act._Effects._ResourcesToCreate.FindAll(x => (x.PutIntoPointer == 2) && (x.Count > 0)).Count > 0) { if (!Sack.HasEnoughSpaceFor(Act._Effects._ResourcesToCreate.FindAll(x => (x.PutIntoPointer == 2) && (x.Count > 0)))) { return(11); } //foreach (ProcessManager.ResourceEnumerator _r in Act._Effects._ResourcesToCreate.FindAll(x => (x.PutIntoPointer == 2) && (x.Count > 0))) // if (!Sack.HasEnoughSpaceFor(_r.Resource, _r.Count)) // return 11; } // Проверка на занятость участвующих в действии // Target: // if (Act._Conditions._TargetBusyness != 0) { if (Act._Target.GetComponent <Unit>() == null) { return(12); } if (Act._Target.GetComponent <Unit>().Busy&& Act._Conditions._TargetBusyness == 2) { return(13); } if (!Act._Target.GetComponent <Unit>().Busy&& Act._Conditions._TargetBusyness == 1) { return(14); } } ///Actor if (Act._Conditions._ActorBusyness != 0) { if (GetComponent <Unit>().Busy&& Act._Conditions._ActorBusyness == 2) { return(15); } if (!GetComponent <Unit>().Busy&& Act._Conditions._ActorBusyness == 1) { return(16); } } /// Проверка на наличие знаний if (Act._Conditions._Knowledges.Count > 0) { foreach (ProcessManager.KnowledgeEnumerator _k in Act._Conditions._Knowledges) { if (!GetComponent <Unit>().HasSuchKnowledges(_k.KnowledgeID, _k.KnowledgeLevel)) { return(17); } } } ///Проверка на наличие инструмента if (Act._Conditions.RequiredTool != ResourceTypeClassification.Resource) { //if (Tool == null)//Если требуется инструмент и его нет // return 18; //if (Act._Conditions.RequiredTool != Tool.Classification)//Если у юнита в руках инструмент неправильного типа // return 19; } return(0); }
//Engine private IEnumerator _ShowSack(Sack Content) { yield return(StartCoroutine(_RiseInfopanel())); Frame = new UIInfoFrame(Infopanel, Content); }
private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { //check for each item available and add. //itemtype references the item array found under the inventoryScript //gameobject. //check if full so we can add the items if (InventoryScript.MyInstance.MyEmptySlotCount > 0) { if (itemType == "Leaflet") { Leaflet leaflet = (Leaflet)Instantiate(InventoryScript.MyInstance.items[1]); InventoryScript.MyInstance.AddItem(leaflet); } else if (itemType == "Egg") { Egg egg = (Egg)Instantiate(InventoryScript.MyInstance.items[2]); InventoryScript.MyInstance.AddItem(egg); } else if (itemType == "Sword") { Sword sword = (Sword)Instantiate(InventoryScript.MyInstance.items[3]); InventoryScript.MyInstance.AddItem(sword); } else if (itemType == "Trident") { Trident trident = (Trident)Instantiate(InventoryScript.MyInstance.items[4]); InventoryScript.MyInstance.AddItem(trident); } else if (itemType == "Airpump") { AirPump ap = (AirPump)Instantiate(InventoryScript.MyInstance.items[5]); InventoryScript.MyInstance.AddItem(ap); } else if (itemType == "Bar") { PlatinumBar bar = (PlatinumBar)Instantiate(InventoryScript.MyInstance.items[6]); InventoryScript.MyInstance.AddItem(bar); } else if (itemType == "Knife") { Knife knife = (Knife)Instantiate(InventoryScript.MyInstance.items[7]); InventoryScript.MyInstance.AddItem(knife); } else if (itemType == "Rope") { Rope rope = (Rope)Instantiate(InventoryScript.MyInstance.items[8]); InventoryScript.MyInstance.AddItem(rope); } else if (itemType == "Skull") { Skull skull = (Skull)Instantiate(InventoryScript.MyInstance.items[9]); InventoryScript.MyInstance.AddItem(skull); } else if (itemType == "Sack") { Sack sack = (Sack)Instantiate(InventoryScript.MyInstance.items[10]); InventoryScript.MyInstance.AddItem(sack); } else if (itemType == "Lantern") { Lantern lantern = (Lantern)Instantiate(InventoryScript.MyInstance.items[11]); InventoryScript.MyInstance.AddItem(lantern); } else if (itemType == "Bottle") { Bottle bottle = (Bottle)Instantiate(InventoryScript.MyInstance.items[12]); InventoryScript.MyInstance.AddItem(bottle); } else if (itemType == "Candle") { Candle candle = (Candle)Instantiate(InventoryScript.MyInstance.items[13]); InventoryScript.MyInstance.AddItem(candle); } else if (itemType == "BlackBook") { BlkBook book = (BlkBook)Instantiate(InventoryScript.MyInstance.items[14]); InventoryScript.MyInstance.AddItem(book); } else if (itemType == "PlasticPile") { PlasticPile plastic = (PlasticPile)Instantiate(InventoryScript.MyInstance.items[15]); InventoryScript.MyInstance.AddItem(plastic); } else if (itemType == "Buoy") { Buoy buoy = (Buoy)Instantiate(InventoryScript.MyInstance.items[16]); InventoryScript.MyInstance.AddItem(buoy); } else if (itemType == "Shovel") { Shovel shovel = (Shovel)Instantiate(InventoryScript.MyInstance.items[17]); InventoryScript.MyInstance.AddItem(shovel); } else if (itemType == "Scarab") { Scarab scarab = (Scarab)Instantiate(InventoryScript.MyInstance.items[18]); InventoryScript.MyInstance.AddItem(scarab); } else if (itemType == "PotOfGold") { PotOfGold gold = (PotOfGold)Instantiate(InventoryScript.MyInstance.items[19]); InventoryScript.MyInstance.AddItem(gold); } else if (itemType == "Bracelet") { Bracelet bracelet = (Bracelet)Instantiate(InventoryScript.MyInstance.items[20]); InventoryScript.MyInstance.AddItem(bracelet); } else if (itemType == "Coal") { Coal coal = (Coal)Instantiate(InventoryScript.MyInstance.items[21]); InventoryScript.MyInstance.AddItem(coal); } else if (itemType == "Figurine") { Figurine fig = (Figurine)Instantiate(InventoryScript.MyInstance.items[22]); InventoryScript.MyInstance.AddItem(fig); } else if (itemType == "Diamond") { Diamond diamond = (Diamond)Instantiate(InventoryScript.MyInstance.items[23]); InventoryScript.MyInstance.AddItem(diamond); } else if (itemType == "Torch") { Torch torch = (Torch)Instantiate(InventoryScript.MyInstance.items[24]); InventoryScript.MyInstance.AddItem(torch); } else if (itemType == "Coins") { Coins coins = (Coins)Instantiate(InventoryScript.MyInstance.items[25]); InventoryScript.MyInstance.AddItem(coins); } else if (itemType == "Key") { Key key = (Key)Instantiate(InventoryScript.MyInstance.items[26]); InventoryScript.MyInstance.AddItem(key); } else if (itemType == "Matches") { Matches matches = (Matches)Instantiate(InventoryScript.MyInstance.items[27]); InventoryScript.MyInstance.AddItem(matches); } else if (itemType == "Wrench") { Wrench wrench = (Wrench)Instantiate(InventoryScript.MyInstance.items[28]); InventoryScript.MyInstance.AddItem(wrench); } else if (itemType == "Screwdriver") { Screwdriver sd = (Screwdriver)Instantiate(InventoryScript.MyInstance.items[29]); InventoryScript.MyInstance.AddItem(sd); } else if (itemType == "Jewels") { Jewels jewels = (Jewels)Instantiate(InventoryScript.MyInstance.items[30]); InventoryScript.MyInstance.AddItem(jewels); } else if (itemType == "Coffin") { Coffin coffin = (Coffin)Instantiate(InventoryScript.MyInstance.items[31]); InventoryScript.MyInstance.AddItem(coffin); } else if (itemType == "Chalice") { Chalice chalice = (Chalice)Instantiate(InventoryScript.MyInstance.items[32]); InventoryScript.MyInstance.AddItem(chalice); } //the following items should not be displayed in the world //but going to add just in case we revamp how these items //are obtained. else if(itemType == "Garlic") { Garlic garlic = (Garlic)Instantiate(InventoryScript.MyInstance.items[33]); InventoryScript.MyInstance.AddItem(garlic); } else if(itemType == "Sceptre") { Sceptre sep = (Sceptre)Instantiate(InventoryScript.MyInstance.items[34]); InventoryScript.MyInstance.AddItem(sep); } Destroy(gameObject); } //probably want to utilize CLI popup here else { Debug.Log("Bag full"); } } }