public void CreateElement(string LotteryNum, BallSize BallSize, List<LotteryNumsInfo> DataSource) { //KaijiangContainer LotteryNums = new KaijiangContainer(); //bord_Lottery.Child = LotteryNums; //LotteryNums.LotteryNumsGrid.ItemsSource = DataSource; LotteryNums.CreateElement(LotteryNum, BallSize); }
public void HitAction(Events eventT) { Debug.Log("Hit action!"); if (EventSpawner.Instance.ActiveEvent()) { EventSpawner.Instance.EndEvent(); } switch (eventT) { case Events.Grow: EventSpawner.Instance.Active = eventT; EventSpawner.Instance.EventEnd = BallSize.Duration + Time.time; BallSize.Grow(); break; case Events.Shrink: EventSpawner.Instance.Active = eventT; EventSpawner.Instance.EventEnd = BallSize.Duration + Time.time; BallSize.Shrink(); break; } }
public void Reactivate() { Body.velocity = Vector2.zero; Size = BallSize.NORMAL; gameObject.SetActive(true); trail.gameObject.SetActive(false); }
private void OnJumpTimerTick(object sender, EventArgs e) { if (_direction == BallDirection.Up) { if (pbBall.Location.Y == -2) { _size = _size == BallSize.Initial ? BallSize.HalfSqueezed : (_size == BallSize.HalfSqueezed ? BallSize.FullSqueezed : BallSize.FullSqueezed); _direction = _size == BallSize.FullSqueezed ? BallDirection.Down : BallDirection.Up; } else { pbBall.Location = _size == BallSize.Initial ? new Point(pbBall.Location.X, pbBall.Location.Y - 1) : new Point(pbBall.Location.X, pbBall.Location.Y - 2); _size = _size == BallSize.FullSqueezed ? BallSize.HalfSqueezed : (_size == BallSize.HalfSqueezed ? BallSize.Initial : BallSize.Initial); } } else if (_direction == BallDirection.Down) { if (pbBall.Location.Y == 2 || pbBall.Location.Y == 4 || pbBall.Location.Y == 6) { _size = _size == BallSize.Initial ? BallSize.HalfSqueezed : (_size == BallSize.HalfSqueezed ? BallSize.FullSqueezed : BallSize.FullSqueezed); pbBall.Location = _size == BallSize.HalfSqueezed || _size == BallSize.FullSqueezed ? new Point(pbBall.Location.X, pbBall.Location.Y + 2) : pbBall.Location; _direction = _size == BallSize.FullSqueezed ? BallDirection.Up : BallDirection.Down; } else { _size = _size == BallSize.FullSqueezed ? BallSize.HalfSqueezed : (_size == BallSize.HalfSqueezed ? BallSize.Initial : BallSize.Initial); pbBall.Location = _size == BallSize.Initial ? new Point(pbBall.Location.X, pbBall.Location.Y + 1) : pbBall.Location; } } }
public TournamentCategory(string name, Sex sex, int minAge, int maxAge, BallSize ball, TournamentSystem system) { CategoryName = name; Sex = sex; MinAge = minAge; MaxAge = maxAge; Ball = ball; System = system; }
public void EndEvent() { switch (Active) { case EventT.Events.Grow: case EventT.Events.Shrink: BallSize.Reset(); break; } Active = EventT.Events.None; }
// Sets up ball's localScale to reflect the selected BallSize void SetSize(BallSize size) { if (size.Equals(BallSize.Small)) { ball.transform.localScale = new Vector3(smallScale, smallScale, smallScale); } if (size.Equals(BallSize.Medium)) { ball.transform.localScale = new Vector3(medScale, medScale, medScale); } if (size.Equals(BallSize.Large)) { ball.transform.localScale = new Vector3(largeScale, largeScale, largeScale); } }
// Spawns ball with given difficulty parameters public void SpawnBall(BallSize size, BallSpeed speed, BallInitAngle initAngle, BallHorizDirection hDirect) { SetSpeed(speed); SetAngle(initAngle); SetSize(size); SetDirection(hDirect); Vector3 chosenSpawn = ChooseSpawn(); currBalls += 1; //vertDirection = Random.Range(0, 2) * 2 - 1; //initialImpulse = new Vector3(initialImpulse.x * horizDirection, initialImpulse.y, initialImpulse.z * vertDirection); ball.GetComponent <BallBehavior>().initialImpulse = initialImpulse; Instantiate(ball, chosenSpawn, Quaternion.identity); Debug.Log("Spawned ball."); ResetBallPrefab(); }
/// <summary> /// Get an inactive BallController object with given BallSize. /// </summary> /// <returns></returns> public BallController GetBallControl(BallSize ballSize) { //Find in the list BallController bigBallControl = listBallControl.Where((a => !a.gameObject.activeInHierarchy && a.BallSize.Equals(ballSize))).FirstOrDefault(); if (bigBallControl == null) { //Did not find one -> create new one BallController ballControlPrefab = ballControlPrefabs.Where(a => a.BallSize.Equals(ballSize)).FirstOrDefault(); bigBallControl = Instantiate(ballControlPrefab, Vector3.zero, Quaternion.identity); bigBallControl.gameObject.SetActive(false); listBallControl.Add(bigBallControl); } return(bigBallControl); }
public void ParseBallSize() { Vector2 _state = new Vector2(transform.localScale.x, transform.localScale.y); if (_state.x >= 0.4f && _state.x < 0.8f) { size = BallSize.Small; } if (_state.x >= 0.8f && _state.x < 1f) { size = BallSize.Medium; } if (_state.x >= 1f && _state.x < 1.4f) { size = BallSize.Large; } if (_state.x > 1.4f && _state.x < 1.6f) { size = BallSize.Extra_Large; } BallsizeDisplay.text = size.ToString(); }
public void CreateElement(string LotteryNum, Controls.BallSize size) { BallSize = size; lotteryNums = LotteryNum; _srv.GetCurrenIssuNoAsync((int)MainPage.lotteryType); _srv.GetLastLotteryNumAsync((int)MainPage.lotteryType); }
void Start() { Size = BallSize.NORMAL; }
public void AddCategory() { string categoryName; while (true) { Console.WriteLine("\nCategory name:"); categoryName = Console.ReadLine(); if (!actualTournament.HasCategory(categoryName)) { break; } Console.WriteLine("Category already exists!"); } int minAge = StaticMethods.ReadNumber("Minimum players age:"); int maxAge = StaticMethods.ReadNumber("Maximum players age"); bool done = false; Sex sex = Sex.Both; while (!done) { Console.WriteLine("\nMale, Female or does not matter category - write 'm' or 'f' or 'b' (both): "); lineToRead = Console.ReadLine(); if (lineToRead.Length != 0) { done = true; switch (lineToRead[0]) { case 'm': sex = Sex.Male; break; case 'f': sex = Sex.Female; break; case 'b': sex = Sex.Both; break; default: done = false; Console.WriteLine("wrong input!"); continue; } } } done = false; BallSize ball = BallSize.Seven; while (!done) { Console.WriteLine("\nSize of ball ('5','6','7'): "); lineToRead = Console.ReadLine(); if (lineToRead.Length != 0) { done = true; switch (lineToRead[0]) { case '5': ball = BallSize.Five; break; case '6': ball = BallSize.Six; break; case '7': ball = BallSize.Seven; break; default: done = false; Console.WriteLine("wrong input!"); break; } } } TournamentSystem system; while (true) { Console.WriteLine("/nTournament system ('e' - Everyone with everyone, 'f' - First loss out): "); lineToRead = Console.ReadLine(); if (lineToRead.Length != 0) { if (lineToRead[0] == 'f') { system = TournamentSystem.FirstLossOut; break; } if (lineToRead[0] == 'e') { system = TournamentSystem.EveryoneWithEveryone; break; } } } Console.WriteLine("\nCategory was successfully created!"); actualTournament.AddCategory(new TournamentCategory(categoryName, sex, minAge, maxAge, ball, system)); }
public void Save(XElement e) { XElement elemGameSetting = new XElement("GameSetting"); e.Add(elemGameSetting); XElement elem = new XElement("OurTeamOffensive"); XAttribute attri = new XAttribute("Value", OurTeamOffensive.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("Scaling"); attri = new XAttribute("Value", Scaling.ToString()); elem.Add(attri); elemGameSetting.Add(elem); // 11-09-2010 Scott elem = new XElement("ScalingAnimation"); attri = new XAttribute("Value", ScalingAnimation.ToString()); elem.Add(attri); elemGameSetting.Add(elem); // 10-08-2010 Scott elem = new XElement("OffensiveMainField"); attri = new XAttribute("Value", OffensiveMainField.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("OffensiveSubField"); attri = new XAttribute("Value", OffensiveSubField.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("DefensiveMainField"); attri = new XAttribute("Value", DefensiveMainField.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("DefensiveSubField"); attri = new XAttribute("Value", DefensiveSubField.ToString()); elem.Add(attri); elemGameSetting.Add(elem); // 10-26-2011 Scott elem = new XElement("KickMainField"); attri = new XAttribute("Value", KickMainField.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("KickSubField"); attri = new XAttribute("Value", KickSubField.ToString()); elem.Add(attri); elemGameSetting.Add(elem); // end elem = new XElement("UserFolder"); attri = new XAttribute("Value", UserFolder); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("UserType"); attri = new XAttribute("Value", UserType.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("ProductType"); attri = new XAttribute("Value", ProductType.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("PlaygroundType"); attri = new XAttribute("Value", PlaygroundType.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("CurrentTheme"); attri = new XAttribute("Value", CurrentTheme); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("GridLine"); attri = new XAttribute("Value", GridLine.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("SnapValue"); attri = new XAttribute("Value", SnapValue.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("SnapToGrid"); attri = new XAttribute("Value", SnapToGrid.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("ShowBall"); attri = new XAttribute("Value", ShowBall.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("BallSize"); attri = new XAttribute("Value", BallSize.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("Landscape"); attri = new XAttribute("Value", Landscape.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("ShowPlayground"); attri = new XAttribute("Value", ShowPlayground.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("EnableColor"); attri = new XAttribute("Value", EnableColor.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("EnableSymbolColor"); attri = new XAttribute("Value", EnableSymbolColor.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("EnableTitle"); attri = new XAttribute("Value", EnableTitle.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("PlayerAngle"); attri = new XAttribute("Value", PlayerAngle.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("PlayerAppearance"); attri = new XAttribute("Value", PlayerAppearance.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("PlayerDash"); attri = new XAttribute("Value", PlayerDash.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("PlayerSzie"); attri = new XAttribute("Value", PlayerSize.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("PlayerTextVisibility"); attri = new XAttribute("Value", PlayerTextVisibility.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("PlayerThickness"); attri = new XAttribute("Value", PlayerThickness.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("ImageShowPlayground"); attri = new XAttribute("Value", ImageShowPlayground.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("ImageEnableColor"); attri = new XAttribute("Value", ImageEnableColor.ToString()); elem.Add(attri); elemGameSetting.Add(elem); elem = new XElement("ImageEnableSymbolColor"); attri = new XAttribute("Value", ImageEnableSymbolColor.ToString()); elem.Add(attri); elemGameSetting.Add(elem); }
private void StopJump() { pbBall.Location = new Point(pbBall.Location.X, pbBall.Location.X); _size = BallSize.Initial; _timer.Stop(); }
public Ball() { InitializeComponent(); __size = BallSize.Initial; _direction = BallDirection.Stop; }