Exemplo n.º 1
0
        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());
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
    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);
    }
Exemplo n.º 4
0
    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];
        }
    }
Exemplo n.º 5
0
    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);
    }
Exemplo n.º 6
0
 private PhysicalFeatureSet(PositionCategory positionCategory, List <PhysicalFeature> physicalFeatures)
 {
     PositionCategory  = positionCategory ?? throw new System.ArgumentNullException(nameof(positionCategory));
     _physicalFeatures = physicalFeatures ?? throw new System.ArgumentNullException(nameof(physicalFeatures));
 }
Exemplo n.º 7
0
 public Position(PositionCategory cat, int idx)
 {
     this.Category = cat;
     this.Index    = idx;
 }
Exemplo n.º 8
0
 bool isVacant(PositionCategory category, int index)
 {
     return(this.isVacant(new Position(category, index)));
 }
Exemplo n.º 9
0
 public Item GetItem(PositionCategory category, int index)
 {
     return(this.GetItem(new Position(category, index)));
 }
Exemplo n.º 10
0
 private static void InitCategory(HSceneProc __instance, ref IEnumerator __result)
 {
     __result = __result.AppendCo(() => category = (PositionCategory)__instance.lstInitCategory.First());
 }
Exemplo n.º 11
0
 private static void ChangeCategory(int _category)
 {
     category = (PositionCategory)_category;
 }