예제 #1
0
    private void Awake()
    {
        fm = new FuzzyModule();
        FuzzyVariable DistToTarget = fm.CreateFLV("DistToTarget");

        FzSet Target_Close  = DistToTarget.AddLeftShoulderSet("Target_Close", 0, 25, 150);
        FzSet Target_Medium = DistToTarget.AddTriangleSet("Target_Medium", 25, 50, 300);
        FzSet Target_Far    = DistToTarget.AddRightShoulderSet("Target_Far", 150, 300, 500);

        FuzzyVariable AmmoStatus = fm.CreateFLV("AmmoStatus");

        FzSet Ammo_Low   = AmmoStatus.AddLeftShoulderSet("Ammo_Low", 0, 0, 10);
        FzSet Ammo_Okay  = AmmoStatus.AddTriangleSet("Ammo_Okay", 0, 10, 30);
        FzSet Ammo_Loads = AmmoStatus.AddRightShoulderSet("Ammo_Loads", 10, 30, 40);

        FuzzyVariable Desirability = fm.CreateFLV("Desirablility");

        FzSet Undersirable  = Desirability.AddLeftShoulderSet("Undesirable", 0, 25, 50);
        FzSet Desirable     = Desirability.AddTriangleSet("Desirable", 25, 50, 75);
        FzSet VeryDesirable = Desirability.AddRightShoulderSet("VeryDesirable", 50, 75, 100);

        fm.AddRule(new FzAND(Target_Close, Ammo_Low), Undersirable);
        fm.AddRule(new FzAND(Target_Close, Ammo_Okay), Undersirable);
        fm.AddRule(new FzAND(Target_Close, Ammo_Loads), Undersirable);
        fm.AddRule(new FzAND(Target_Medium, Ammo_Low), Desirable);
        fm.AddRule(new FzAND(Target_Medium, Ammo_Okay), VeryDesirable);
        fm.AddRule(new FzAND(Target_Medium, Ammo_Loads), VeryDesirable);
        fm.AddRule(new FzAND(Target_Far, Ammo_Low), Undersirable);
        fm.AddRule(new FzAND(Target_Far, Ammo_Okay), Desirable);
        fm.AddRule(new FzAND(Target_Far, Ammo_Loads), Desirable);
    }
예제 #2
0
    private void InitPromisingRegionFM()
    {
        // Promising Region FuzzyModule
        promisingRegionFM = new FuzzyModule();
        FuzzyVariable DistToRegion = promisingRegionFM.CreateFLV("DistToRegion");

        FzSet Dist_Close  = DistToRegion.AddLeftShoulderSet("Dist_Close", 0, 50, 150);
        FzSet Dist_Medium = DistToRegion.AddTriangleSet("Dist_Medium", 50, 150, 200);
        FzSet Dist_Far    = DistToRegion.AddRightShoulderSet("Dist_Far", 150, 250, 300);

        FuzzyVariable RegionWealth = promisingRegionFM.CreateFLV("RegionWealth");

        FzSet Region_Poor   = RegionWealth.AddLeftShoulderSet("Region_Poor", 0, 300, 750);
        FzSet Region_Decent = RegionWealth.AddTriangleSet("Region_Decent", 750, 1500, 2700);
        FzSet Region_Rich   = RegionWealth.AddRightShoulderSet("Region_Rich", 2250, 2700, Region.MAX_RESOURCE_COUNT);

        FuzzyVariable Desirability = promisingRegionFM.CreateFLV("Desirability");

        FzSet Undersirable   = Desirability.AddLeftShoulderSet("Undesirable", 0, 25, 50);
        FzSet Desirable      = Desirability.AddTriangleSet("Desirable", 25, 50, 75);
        FzSet Very_Desirable = Desirability.AddRightShoulderSet("VeryDesirable", 50, 75, 100);

        promisingRegionFM.AddRule(new FzAND(Dist_Close, Region_Poor), Undersirable);
        promisingRegionFM.AddRule(new FzAND(Dist_Close, Region_Decent), Desirable);
        promisingRegionFM.AddRule(new FzAND(Dist_Close, Region_Rich), Very_Desirable);
        promisingRegionFM.AddRule(new FzAND(Dist_Medium, Region_Poor), Undersirable);
        promisingRegionFM.AddRule(new FzAND(Dist_Medium, Region_Decent), Undersirable);
        promisingRegionFM.AddRule(new FzAND(Dist_Medium, Region_Rich), Very_Desirable);
        promisingRegionFM.AddRule(new FzAND(Dist_Far, Region_Poor), Undersirable);
        promisingRegionFM.AddRule(new FzAND(Dist_Far, Region_Decent), Undersirable);
        promisingRegionFM.AddRule(new FzAND(Dist_Far, Region_Rich), Very_Desirable);
    }
예제 #3
0
파일: Herde.cs 프로젝트: poeely/UnityAAI
    private void InitSheepDesireFM()
    {
        sheepDesireFM = new FuzzyModule();
        FuzzyVariable DistToTarget = sheepDesireFM.CreateFLV("DistToOgre");

        FzSet Dist_Close  = DistToTarget.AddLeftShoulderSet("Dist_Close", 0, 25, 150);
        FzSet Dist_Medium = DistToTarget.AddTriangleSet("Dist_Medium", 25, 50, 300);
        FzSet Dist_Far    = DistToTarget.AddRightShoulderSet("Dist_Far", 150, 300, 500);

        FuzzyVariable AmmoStatus = sheepDesireFM.CreateFLV("Hunger");

        FzSet Hunger_Low     = AmmoStatus.AddLeftShoulderSet("Hunger_Low", 0, 0, 10);
        FzSet Hunger_Okay    = AmmoStatus.AddTriangleSet("Hunger_Okay", 0, 10, 30);
        FzSet Hunger_Intense = AmmoStatus.AddRightShoulderSet("Hunger_Intense", 10, 30, 40);

        FuzzyVariable Desirability = sheepDesireFM.CreateFLV("Desirability");

        FzSet Undersirable  = Desirability.AddLeftShoulderSet("Undesirable", 0, 25, 50);
        FzSet Desirable     = Desirability.AddTriangleSet("Desirable", 25, 50, 75);
        FzSet VeryDesirable = Desirability.AddRightShoulderSet("VeryDesirable", 50, 75, 100);

        sheepDesireFM.AddRule(new FzAND(Dist_Close, Hunger_Low), Undersirable);
        sheepDesireFM.AddRule(new FzAND(Dist_Close, Hunger_Okay), Undersirable);
        sheepDesireFM.AddRule(new FzAND(Dist_Close, Hunger_Intense), Undersirable);
        sheepDesireFM.AddRule(new FzAND(Dist_Medium, Hunger_Low), Desirable);
        sheepDesireFM.AddRule(new FzAND(Dist_Medium, Hunger_Okay), VeryDesirable);
        sheepDesireFM.AddRule(new FzAND(Dist_Medium, Hunger_Intense), VeryDesirable);
        sheepDesireFM.AddRule(new FzAND(Dist_Far, Hunger_Low), Undersirable);
        sheepDesireFM.AddRule(new FzAND(Dist_Far, Hunger_Okay), Desirable);
        sheepDesireFM.AddRule(new FzAND(Dist_Far, Hunger_Intense), Desirable);
    }