示例#1
0
 public Animal(Types type, Gender gender, ConsumptionType consumptionType, Sizes size)
 {
     this.type            = type;
     this.gender          = gender;
     this.consumptionType = consumptionType;
     this.size            = size;
 }
示例#2
0
 protected Animal(int x, int y, Gender gender, ConsumptionType consumptionType, World world, int health = 5)
     : base(x, y, world)
 {
     ConsumptionType = consumptionType;
     Health          = health;
     Gender          = gender;
 }
 private static IEnumerable<string> GetConsumptionTypes(ConsumptionType? type)
 {
     if (type == null) return Enumerable.Empty<string>();
     return (Enum.GetValues(typeof (ConsumptionType))
         .Cast<ConsumptionType>()
         .Where(value => type.Value.HasFlag(value))
         .Select(value => Enum.GetName(typeof (ConsumptionType), value)));
 }
示例#4
0
        public ActionResult CostCentres(ConsumptionType consumptionType, string term, string id)
        {
            var centres = context.CostCentres.Where(centre => ((centre.ConsumptionType & consumptionType) > 0));

            if (!string.IsNullOrEmpty(term))
            {
                centres = centres.Where(centre => centre.CostCode.Contains(term) || centre.Name.Contains(term));
            }
            if (!string.IsNullOrEmpty(id))
            {
                centres = centres.Where(centre => centre.CostCode == id);
            }
            var model = centres.Select(centre => new { centre.CostCode, centre.Name, centre.CurrencyCode });

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
示例#5
0
 public void Consume(ConsumptionType type)
 {
     if (type == ConsumptionType.Food)
     {
         hungerMeter += worldInfo.grainConsumptionValue;
         if (hungerMeter > worldInfo.chickenMaxTimeUntilDeathHunger)
         {
             hungerMeter = worldInfo.chickenMaxTimeUntilDeathHunger;
         }
     }
     else if (type == ConsumptionType.Water)
     {
         thirstMeter += worldInfo.waterConsumptionValue;
         if (thirstMeter > worldInfo.chickenMaxTimeUntilDeathThirst)
         {
             thirstMeter = worldInfo.chickenMaxTimeUntilDeathThirst;
         }
     }
 }
示例#6
0
 public Dolphin(int x, int y, Gender gender, ConsumptionType consumptionType, World world)
     : base(x, y, gender, consumptionType, world)
 {
 }
示例#7
0
 public static Animal Create(ConsumptionType consumptionType, Sizes size)
 {
     return(new Animal(consumptionType, size));
 }
示例#8
0
 public Owl(int x, int y, Gender gender, ConsumptionType consumptionType, World world)
     : base(x, y, gender, consumptionType, world)
 {
     Predator   = consumptionType == ConsumptionType.Predator;
     this.world = world;
 }
示例#9
0
文件: Animal.cs 项目: jaronpoel/S2
 public String getString()
 {
     return("ConsumptionType: " + ConsumptionType.ToString().ToLower() + ", Size: " + Size.ToString().ToLower());
 }
示例#10
0
文件: Animal.cs 项目: jaronpoel/S2
 public Animal(ConsumptionType consumptionType, Sizes size)
 {
     ConsumptionType = consumptionType;
     Size            = size;
 }
示例#11
0
 public ConsumerConfigBuilder <T> SetConsumptionType(ConsumptionType type)
 {
     _conf.ConsumptionType = type;
     return(this);
 }