private void Start() { _backgroudImage = GetComponent <Image>(); _joystickImage = transform.GetChild(0).GetComponent <Image>(); _startPoint = _joystickImage.rectTransform.position; _originalColor = _joystickImage.color; _helper = new MoveRotateHelper(); _helperCalc = new CalculationsHelper(); _anim = GetComponent <Animator>(); }
public static IList <T> GetNearBy <T>(this IList <T> positions, IPosition position, int delta = 0) where T : ICurrentPosition => positions.Where(p => { var xPositionCompare = CalculationsHelper.Distance(p.Position.Coordinate.X.Value, position.Coordinate.X.Value) <= delta; var yPositionCompare = CalculationsHelper.Distance(p.Position.Coordinate.Y.Value, position.Coordinate.Y.Value) <= delta; return(xPositionCompare && yPositionCompare); }).ToList();
void MaintainScore(Point coordinate) { if (!CalculationsHelper.IsWithinRangeOfCloud((int)coordinate.X, (int)coordinate.Y)) { return; } GameModel.Score += 100; if (GameModel.Score >= 50000) { GameModel.ShowCloud = Visibility.Collapsed; } }
public Generator(MissionGeneratorData generatorData, IFollowers followers, ISavedMission savedMission, TimeManager timeManager) { this.generatorData = generatorData; this.savedMission = savedMission; missionCycles = CollectionsHelper.CombineListsToDictionary(new List <List <int> > { generatorData.EasyModeMissionCycle.ToList(), generatorData.MediumModeMissionCycle.ToList(), generatorData.HardModeMissionCycle.ToList() }); missionCycleCount = CalculationsHelper.GetLowestNumberFromThreeNumbers(generatorData.EasyModeMissionCycle.Count, generatorData.MediumModeMissionCycle.Count, generatorData.HardModeMissionCycle.Count); this.followers = followers; this.timeManager = timeManager; }
void OnFingersRegistered(FingerList fingers) { var screen = _controller.CalibratedScreens.ClosestScreenHit(fingers[0]); var coordinate = CalculationsHelper.GetNormalizedXAndY(fingers, screen); _dispatcher.Invoke(new Action(() => { GameModel.Fingers = fingers.Count; MaintainScore(coordinate); UpdateUIProperties(coordinate); })); SetLeapAsMouse(fingers, coordinate); }
public void OnClickEnterClub() { var difficulty = activeMissionData.Difficulty; var currencyReward = CalculationsHelper.CalculateReward(activeMissionData.StylePointValues, currentStylePoints, difficulty.MaxCurrencyReward, difficulty.MINCurrencyReward); var followersReward = CalculationsHelper.CalculateReward(activeMissionData.StylePointValues, currentStylePoints, difficulty.MAXFollowersReward, difficulty.MINFollowersReward); foreach (var client in wearablesOnClient) { EventBroker.Instance().SendMessage(new EventUpdatePlayerInventory(client.Value, -1)); } EventBroker.Instance().SendMessage(new ShowRewardMessage(currencyReward, followersReward)); }
public void Smooth(ICharacter character, int n, int r, int call, ISingleBet pot, int raise) { if (call <= 0) { this.actions.CheckAction(character); } else { if (call >= CalculationsHelper.RoundNumber(character.Chips, n)) { if (character.Chips > call) { this.actions.CallAction(character, call, pot); } else if (character.Chips <= call) { character.HasRaised = false; character.IsInTurn = false; character.Chips = 0; character.CharacterStatus.Text = "Call " + character.Chips; pot.AddBet(character.Chips); } } else { if (raise > 0) { if (character.Chips >= raise * 2) { raise *= 2; this.actions.RaiseAction(character, raise, pot); } else { this.actions.CallAction(character, call, pot); } } else { raise = call * 2; this.actions.RaiseAction(character, raise, pot); } } } if (character.Chips <= 0) { character.FoldTurn = true; } }
List <SavableRequirementData> GenerateNewRequirements(int requirementAmount) { var savableMissionRequirements = new List <SavableRequirementData>(); var requirementAmountLeft = requirementAmount; var colorDataList = CollectionsHelper.CreateListOfIndexes(generatorData.Colors.Count); var clothingTypeDataList = CollectionsHelper.CreateListOfIndexes(generatorData.ClothingTypes.Count); while (requirementAmountLeft >= 1) { var requirementValue = CalculationsHelper.NumberGenerator(Mathf.Min(3, requirementAmountLeft)); var colorDataListIndex = CollectionsHelper.GetRandomNonRepeatingIndexFromList(colorDataList); var clothingTypeIndex = CollectionsHelper.GetRandomNonRepeatingIndexFromList(clothingTypeDataList); var rarityDataIndex = Random.Range(1, generatorData.Rarities.Count); savableMissionRequirements.Add(new SavableRequirementData(requirementValue, new List <int> { colorDataListIndex, clothingTypeIndex, rarityDataIndex })); requirementAmountLeft -= requirementValue; } return(savableMissionRequirements); }
public void PH(ICharacter character, int n, int n1, int r, int call, ISingleBet bet, int raise, GameStateType state) { int rnd = this.random.GetRandomNumberInInterval(1, 3); if (state < GameStateType.Turn) { if (call <= 0) { this.actions.CheckAction(character); } if (call > 0) { if (call >= CalculationsHelper.RoundNumber(character.Chips, n1)) { this.actions.FoldAction(character); } if (raise > CalculationsHelper.RoundNumber(character.Chips, n)) { this.actions.FoldAction(character); } if (!character.FoldTurn) { if (call >= CalculationsHelper.RoundNumber(character.Chips, n) && call <= CalculationsHelper.RoundNumber(character.Chips, n1)) { this.actions.CallAction(character, call, bet); } if (raise <= CalculationsHelper.RoundNumber(character.Chips, n) && raise >= CalculationsHelper.RoundNumber(character.Chips, n) / 2) { this.actions.CallAction(character, call, bet); } if (raise <= CalculationsHelper.RoundNumber(character.Chips, n) / 2) { if (raise > 0) { raise = (int)CalculationsHelper.RoundNumber(character.Chips, n); this.actions.CallAction(character, call, bet); } else { raise = call * 2; this.actions.CallAction(character, call, bet); } } } } } if (state >= GameStateType.Turn) { if (call > 0) { if (call >= CalculationsHelper.RoundNumber(character.Chips, n1 - rnd)) { this.actions.FoldAction(character); } if (raise > CalculationsHelper.RoundNumber(character.Chips, n - rnd)) { this.actions.FoldAction(character); } if (!character.FoldTurn) { if (call >= CalculationsHelper.RoundNumber(character.Chips, n - rnd) && call <= CalculationsHelper.RoundNumber(character.Chips, n1 - rnd)) { this.actions.CallAction(character, call, bet); } if (raise <= CalculationsHelper.RoundNumber(character.Chips, n - rnd) && raise >= CalculationsHelper.RoundNumber(character.Chips, n - rnd) / 2) { this.actions.CallAction(character, call, bet); } if (raise <= CalculationsHelper.RoundNumber(character.Chips, n - rnd) / 2) { if (raise > 0) { raise = (int)CalculationsHelper.RoundNumber(character.Chips, n - rnd); this.actions.RaiseAction(character, raise, bet); } else { raise = call * 2; this.actions.RaiseAction(character, raise, bet); } } } } if (call <= 0) { raise = (int)CalculationsHelper.RoundNumber(character.Chips, r - rnd); this.actions.RaiseAction(character, raise, bet); } } if (character.Chips <= 0) { character.FoldTurn = true; } }
public void HP(ICharacter character, int n, int n1, int call, ISingleBet pot, int raise) { int randomInteger = this.random.GetRandomNumberInInterval(1, 4); if (call <= 0) { this.actions.CheckAction(character); } else { if (randomInteger == 1) { if (call <= CalculationsHelper.RoundNumber(character.Chips, n)) { this.actions.CallAction(character, call, pot); } else { this.actions.FoldAction(character); } } if (randomInteger == 2) { if (call <= CalculationsHelper.RoundNumber(character.Chips, n1)) { this.actions.CallAction(character, call, pot); } else { this.actions.FoldAction(character); } } } if (randomInteger == 3) { if (raise == 0) { raise = call * 2; this.actions.RaiseAction(character, raise, pot); } else { if (raise <= CalculationsHelper.RoundNumber(character.Chips, n)) { raise = call * 2; this.actions.RaiseAction(character, raise, pot); } else { this.actions.FoldAction(character); } } } if (character.Chips <= 0) { character.FoldTurn = true; } }
void Start() { _ch = new CalculationsHelper(); _image = GetComponent <Image>(); _t = GetComponent <Button>().transition; }