protected IEnumerable <Tuple <TilePosition, int, IGrabableItem[]> > GetCreatures(CreatureItem creatureData) { int creatureCount = creatureData.CreaturesCount + 1; var possesions = GetPossesions(creatureData, creatureCount); return(creatureData.GetCreaturesInfo().Zip(possesions, (x, y) => Tuple.Create(x.Item1, x.Item2, y))); }
public IEnumerable<Creature> AddCreature(CreatureItem creature, Tile tile) { var creatureDescriptor = builder.Data.CreatureDescriptors[(int)creature.Type]; var duration = creatureDescriptor.MovementDuration * 1000 / 6; duration = MathHelper.Clamp(duration, 500, 1200); var layout = GetGroupLayout(creature); var res = new List<Creature>(); foreach (var tuple in creature.GetCreaturesInfo().Take(creature.CreaturesCount + 1)) { var space = layout.AllSpaces.First(s => tuple.Item1.ToDirections().All(s.Sides.Contains)); res.Add(new Creature(layout, new FourthSpaceRouteElement(space, tile), builder.CreatureToken, builder.ChampionToken.ToEnumerable(), duration, creatureDescriptor.DetectionRange, creatureDescriptor.SightRange)); } return res; }
public IEnumerable <Creature> AddCreature(CreatureItem creature, Tile tile) { var creatureDescriptor = builder.Data.CreatureDescriptors[(int)creature.Type]; var duration = creatureDescriptor.MovementDuration * 1000 / 6; duration = MathHelper.Clamp(duration, 500, 1200); var layout = GetGroupLayout(creature); var res = new List <Creature>(); foreach (var tuple in creature.GetCreaturesInfo().Take(creature.CreaturesCount + 1)) { var space = layout.AllSpaces.First(s => tuple.Item1.ToDirections().All(s.Sides.Contains)); res.Add(new Creature(layout, new FourthSpaceRouteElement(space, tile), builder.CreatureToken, builder.ChampionToken.ToEnumerable(), duration, creatureDescriptor.DetectionRange, creatureDescriptor.SightRange)); } return(res); }