//Create a Bee //paint Bee //update lifecycle Bee //remove Bee public void CreateBee() { IBee bee = (IBee)_lifeFactory.CreateLivingBeing(LivingEntityEnum.Bee); List <int> availableIds = bees.Select(a => a.BeeId).ToList(); bee.BeeId = _utilitiesResolver.GetMinimumNumberFromASequenceOfNumbers(availableIds); bee.BeeLifeCycleTotalCount = rand.Next(_minBeeLifeCycle, _maxBeeLifeCycle); int selectedIndex = GetRandomWingIndex(BeeEnvironmentEnum.Indoors); BeeWingMovementCycle beeWingAnimationInfo = _beeWingsMovementInvoker.GetBeeSelectedWingAnimation(selectedIndex, BeeEnvironmentEnum.Indoors); bee.BeeIndexWingAnimation = beeWingAnimationInfo.BeeWingMovementIndex; bee.BeeIsOnDisplayIndoors = true; bee.BeeIndoorsWingAnimationImage = beeWingAnimationInfo.BeeWingMovementImage; var beeRandomLocationPoint = GetIndoorsRandomLocationPoint(); var beeIndoorSize = new Size(_widthBeeIndoors, _heightBeeIndoors); bee.BeeIndoorsSize = new Rectangle(beeRandomLocationPoint, beeIndoorSize); bee.BeeEnvironmentBehavior = _movementBehaviorCommandInvoker.SelectBehaviorRandomly(BeeEnvironmentEnum.Indoors); Point exitDoorLocationPoint = new Point(_beehiveExitDoorDimmensions.X, _beehiveExitDoorDimmensions.Y); bee.BeeIndoorsMovementDirection = _beeCommon.GetSelectedMovement(bee.BeeEnvironmentBehavior, beeRandomLocationPoint, exitDoorLocationPoint); bee.BeeIsOnDisplayOuterWorld = false; BeeWingMovementCycle BeeWingsInOuterWorld = _beeWingsMovementInvoker.GetBeeSelectedWingAnimation(selectedIndex, BeeEnvironmentEnum.OuterWorld); bee.BeeOuterWorldWingAnimationImage = BeeWingsInOuterWorld.BeeWingMovementImage; var beehiveWorldEntranceLocationPoint = new Point(_hiveInWorldEntranceDoorLocationX, _hiveInWorldEntranceDoorLocationY); var beeWorldSize = new Size(_widthBeeWorld, _heightBeeWorld); bee.BeeInOuterWorldSize = new Rectangle(beehiveWorldEntranceLocationPoint, beeWorldSize); bee.BeeOuterWorldMovementDirection = MovementDirectionEnum.Static; bee.NextBeeMovementCycle = rand.Next(_minNextMovementIteration, _maxNextMovementIteration); bee.BeeIterationMovementCycleCounter = 0; bee.NextBeeBehaviorType = rand.Next(_minNextBehaviorIteration, _maxNextBehaviorIteration); bee.BeeIterationBehaviorTypeCounter = 0; bee.BeeTargetFlowerID = -1; bee.BeePollenCarryingCapacity = rand.Next(_beeMinimumPollenCarryingCapacity, _beeMaximumPollenCarryingCapacity); bee.BeePollenCollected = 0; bees.Add(bee); }
public IBee SetNextBeeWingMovementCycle(IBee bee, BeeEnvironmentEnum beeEnvironment) { var nextIndex = bee.BeeIndexWingAnimation + 1; if (nextIndex == _beeWingsMovementInvoker.GetTotalBeeAmimationWingFrames(beeEnvironment)) { nextIndex = 0; } BeeWingMovementCycle nextBeeWingMovement = _beeWingsMovementInvoker.GetBeeSelectedWingAnimation(nextIndex, beeEnvironment); bee.BeeIndexWingAnimation = nextBeeWingMovement.BeeWingMovementIndex; if (_beeCommon.BeeIsIndoors(bee.BeeEnvironmentBehavior)) { bee.BeeIndoorsWingAnimationImage = nextBeeWingMovement.BeeWingMovementImage; } if (_beeCommon.BeeIsInOuterWorld(bee.BeeEnvironmentBehavior)) { bee.BeeOuterWorldWingAnimationImage = nextBeeWingMovement.BeeWingMovementImage; } return(bee); }