public PlayerPosition Generate() { // we generate a random percentile Percentile percentileCategory = _percentileGenerator.Generate(); // then, using the 1-NN calculator, we get the nearest neighbour to the percentile var categoryCalculator = new PercentileNearestNeighbourCalculator <PositionCategory>( percentileCategory, _percentileCategories.ToArray()); // and we get the category from the nearest neighbour PositionCategory category = categoryCalculator.GetNearestNeighbourUnderlyingType(); // retrieve positions from the category List <PercentileData <PlayerPosition> > positionsData = _percentilePositions .Where(pp => pp.Object.PositionCategory == category) .ToList(); var min = positionsData.Min(p => p.Percentile); var max = positionsData.Max(p => p.Percentile); var positionPercentile = _percentileGenerator.Generate(min, max); var positionCalculator = new PercentileNearestNeighbourCalculator <PlayerPosition>( positionPercentile, positionsData.ToArray()); return(positionCalculator.GetNearestNeighbourUnderlyingType()); }
public static PhysicalFeatureSet CreateFeatureSet(PositionCategory positionCategory) { PhysicalFeatureSet set = _featureSets.FirstOrDefault(fs => fs.PositionCategory == positionCategory); List <PhysicalFeature> list = new List <PhysicalFeature>(); foreach (PhysicalFeature feature in set.PhysicalFeatures) { list.Add(new PhysicalFeature(feature.FeatureType)); } return(new PhysicalFeatureSet(positionCategory, list)); }
public List <Item> GetEquipments(PositionCategory category) { var result = new List <Item> (); for (int i = 0; i < 5; i++) { var item = this.GetItem(category, i); if (item != null) { result.Add(item); } } return(result); }
public EquipmentRenderer(PositionCategory category, Func <Item, bool>[] checkers) { var gameObject = GameObject.Find(category.ToString()); this.Slots = new List <SlotObject> () { gameObject.GetComponent <SlotObject> (), gameObject.transform.Find("Socket0").GetComponent <SlotObject> (), gameObject.transform.Find("Socket1").GetComponent <SlotObject> (), gameObject.transform.Find("Socket2").GetComponent <SlotObject> (), gameObject.transform.Find("Socket3").GetComponent <SlotObject> (), }; for (int i = 0; i < this.Slots.Count; i++) { var slot = this.Slots[i]; slot.Position = new Position(category, i); slot.Checker = checkers[i]; } }
List <CardType> getEquipmentCards(PositionCategory category) { var items = this.GetEquipments(category); if (items.Count == 0) { return(defaultCards [category]); } var result = new List <CardType> (); foreach (var item in items) { if (item.Cards == null) { continue; } result.AddRange(item.Cards); } return(result); }
private PhysicalFeatureSet(PositionCategory positionCategory, List <PhysicalFeature> physicalFeatures) { PositionCategory = positionCategory ?? throw new System.ArgumentNullException(nameof(positionCategory)); _physicalFeatures = physicalFeatures ?? throw new System.ArgumentNullException(nameof(physicalFeatures)); }
public Position(PositionCategory cat, int idx) { this.Category = cat; this.Index = idx; }
bool isVacant(PositionCategory category, int index) { return(this.isVacant(new Position(category, index))); }
public Item GetItem(PositionCategory category, int index) { return(this.GetItem(new Position(category, index))); }
private static void InitCategory(HSceneProc __instance, ref IEnumerator __result) { __result = __result.AppendCo(() => category = (PositionCategory)__instance.lstInitCategory.First()); }
private static void ChangeCategory(int _category) { category = (PositionCategory)_category; }