Beispiel #1
0
    // = Helper.FillAlienJibs(PersonPriority);//


    public static Dictionary <string, int> FillPrioritys(Dictionary <SaveLoadData.TypePrefabs, PriorityFinder> pioritys)
    {
        var max = Enum.GetValues(typeof(SaveLoadData.TypePrefabs)).Length - 1;

        var _CollectionPowerAllTypes = new Dictionary <string, int>();

        SaveLoadData.TypePrefabs prefabNameType;
        SaveLoadData.TypePrefabs prefabNameTypeTarget;
        for (int ind = 0; ind < max; ind++)
        {
            prefabNameType = (SaveLoadData.TypePrefabs)Enum.Parse(typeof(SaveLoadData.TypePrefabs), ind.ToString());
            //if (Helper.IsTypePrefabNPC(prefabNameType.ToString()))
            if (pioritys.ContainsKey(prefabNameType))
            {
                ModelNPC.ObjectData objData   = BilderGameDataObjects.BildObjectData(prefabNameType.ToString());
                PriorityFinder      prioritys = pioritys[prefabNameType];
                for (int indT = 0; indT < max; indT++)
                {
                    prefabNameTypeTarget = (SaveLoadData.TypePrefabs)Enum.Parse(typeof(SaveLoadData.TypePrefabs), indT.ToString());
                    ModelNPC.ObjectData objDataTarget = BilderGameDataObjects.BildObjectData(prefabNameTypeTarget.ToString());
                    int    power      = GetPriorityPower(objDataTarget, prioritys);
                    string keyJoinNPC = prefabNameType + "_" + prefabNameTypeTarget;
                    _CollectionPowerAllTypes.Add(keyJoinNPC, power);
                }
            }
        }
        return(_CollectionPowerAllTypes);
    }
Beispiel #2
0
    public static List <SaveLoadData.TypePrefabs> GetPrioritysTypeModel(PriorityFinder priority)
    {
        List <SaveLoadData.TypePrefabs> getPrioritysTypeModel = new List <SaveLoadData.TypePrefabs>();

        getPrioritysTypeModel.AddRange(priority.PrioritysTypeModelAll);

        foreach (var item in priority.PrioritysTypeModelNPC)
        {
            var prioriT = (SaveLoadData.TypePrefabs)Enum.Parse(typeof(SaveLoadData.TypePrefabs), item.ToString());
            getPrioritysTypeModel.Add(prioriT);
        }
        foreach (var item in priority.PrioritysTypeModelFloor)
        {
            var prioriT = (SaveLoadData.TypePrefabs)Enum.Parse(typeof(SaveLoadData.TypePrefabs), item.ToString());
            getPrioritysTypeModel.Add(prioriT);
        }
        foreach (var item in priority.PrioritysTypeModelFlore)
        {
            var prioriT = (SaveLoadData.TypePrefabs)Enum.Parse(typeof(SaveLoadData.TypePrefabs), item.ToString());
            getPrioritysTypeModel.Add(prioriT);
        }
        foreach (var item in priority.PrioritysTypeModelWood)
        {
            var prioriT = (SaveLoadData.TypePrefabs)Enum.Parse(typeof(SaveLoadData.TypePrefabs), item.ToString());
            getPrioritysTypeModel.Add(prioriT);
        }
        foreach (var item in priority.PrioritysTypeModelWall)
        {
            var prioriT = (SaveLoadData.TypePrefabs)Enum.Parse(typeof(SaveLoadData.TypePrefabs), item.ToString());
            getPrioritysTypeModel.Add(prioriT);
        }


        return(getPrioritysTypeModel);
    }
Beispiel #3
0
    public static int GetPriorityPower(string id, PriorityFinder priority)
    {
        if (Storage.ReaderWorld.CollectionInfoID.ContainsKey(id))
        {
            Debug.Log("######### Error GetPrioriryPower=" + id);
        }

        int power = 0;

        var objData = Storage.ReaderWorld.CollectionInfoID[id].Data;

        return(GetPriorityPower(objData, priority));
    }
Beispiel #4
0
    public static int GetPriorityPower(ModelNPC.ObjectData objData, PriorityFinder priority)
    {
        int power = 0;

        SaveLoadData.TypePrefabs        typeModel = objData.TypePrefab;
        PoolGameObjects.TypePoolPrefabs typePool  = objData.TypePoolPrefab;
        TypesBiomNPC biomNPC = GetBiomByTypeModel(typeModel);

        int slotPower     = 3;
        int maxtPrioprity = 10;

        //maxtPrioprity = priority.GetPrioritysTypeModel().Count() * slotPower;
        maxtPrioprity = GetPrioritysTypeModel(priority).Count() * slotPower;
        //foreach (SaveLoadData.TypePrefabs itemModel in priority.GetPrioritysTypeModel())
        foreach (SaveLoadData.TypePrefabs itemModel in GetPrioritysTypeModel(priority))
        {
            if (itemModel == typeModel)
            {
                power += maxtPrioprity;
                break;
            }
            maxtPrioprity -= slotPower;
        }
        maxtPrioprity = priority.PrioritysTypeBiomNPC.Count() * slotPower;
        foreach (TypesBiomNPC itemBiom in priority.PrioritysTypeBiomNPC)
        {
            if (itemBiom == biomNPC)
            {
                power += maxtPrioprity;
                break;
            }
            maxtPrioprity -= slotPower;
        }
        maxtPrioprity = priority.PrioritysTypeBiomNPC.Count() * slotPower;
        foreach (PoolGameObjects.TypePoolPrefabs itemPool in priority.PrioritysTypePool)
        {
            if (itemPool == typePool)
            {
                power += maxtPrioprity;
                break;
            }
            maxtPrioprity -= slotPower;
        }

        return(power);
    }