private int GetRandomWingIndex(BeeEnvironmentEnum beeEnvironment) { int totalWingsFrames = _beeWingsMovementInvoker.GetTotalBeeAmimationWingFrames(beeEnvironment); int randomWingIndex = rand.Next(0, totalWingsFrames); return(randomWingIndex); }
public BeeWingMovementCycle GetBeeSelectedWingAnimation(int index, BeeEnvironmentEnum beeEnvironment) { var selectedWings = GetBeeWingsMovementCycles(beeEnvironment); var selectedWingImage = selectedWings[index]; return(selectedWingImage); }
public BeeEnvironmentBehaviorEnum SelectBehaviorRandomly(BeeEnvironmentEnum beeEnvironment) { var environment = beeEnvironment.ToString().ToLower(); var allBehaviors = Enum.GetValues(typeof(BeeEnvironmentBehaviorEnum)).Cast <BeeEnvironmentBehaviorEnum>().ToList(); var selectedBehaviors = allBehaviors.Where(a => a.ToString().ToLower().Contains(environment)).ToList(); var index = rand.Next(0, selectedBehaviors.Count); BeeEnvironmentBehaviorEnum selectedBehavior = selectedBehaviors[index]; return(selectedBehavior); }
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); }
private List <BeeWingMovementCycle> GetBeeWingsMovementCycles(BeeEnvironmentEnum beeEnvironment) { var selectedWingMovementCycle = beeWingsInEnvironments.Where(a => a.BeeEnvironmentType == beeEnvironment).FirstOrDefault(); return(selectedWingMovementCycle.BeeWings); }
public int GetTotalBeeAmimationWingFrames(BeeEnvironmentEnum beeEnvironment) { var allWings = GetBeeWingsMovementCycles(beeEnvironment); return(allWings.Count); }