void LocationProvider_OnLocationUpdated(object sender, LocationUpdatedEventArgs e) { if (_isInitialized) { _targetPosition = Conversions.GeoToWorldPosition(e.Location, _map.CenterMercator, _map.WorldRelativeScale).ToVector3xz(); if (balls == null) { balls = new Balls(); balls.balls = new List <Ball>(8); double lat_increment = -0.0001529; double lng_increment = -0.0000414; for (int i = 1; i < 9; i++) { Ball ball = new Ball(); ball.id = i.ToString(); ball.catched = "0"; ball.game = "1"; ball.user = "******"; ball.lat = (e.Location.x + lat_increment * i).ToString(); ball.lng = (e.Location.y + lng_increment * i).ToString(); balls.balls.Add(ball); } UpdateBallsPosition(); } } }
public void addFireBall() { //create the FireBall with Center and angle for moving depending on the state of the plane FireBall fireBall = new FireBall(Plane.getCenter(), Plane.getAngle()); Balls.Add(fireBall); }
public override void OnCollisionEnter(Balls ball, Collision collision) { if (collision.collider.tag == "Active") { ball.TransitionToState(ball.activeState); } }
public Container(long[] matrix) { for (var i = 0; i < matrix.Length; i++) { Balls.Add(i, matrix[i]); } }
public void AddBall(Point center) { Ball b = new Ball(); b.Center = center; Balls.Add(b); }
/// <summary> /// <see cref="IGameFieldView.AddBall(Vector2)"/> /// </summary> public IBallView AddBall(Vector2 position) { var ball = Instantiate(_ballPrefab, position, new Quaternion(), this.transform); Balls.Add(ball); return(ball); }
private void Awake() { lasttime = Time.time; rigidbody = GetComponent <Rigidbody2D> (); balls = Resources.Load <Balls> ("Ball"); sprite = GetComponentInChildren <SpriteRenderer> (); }
private void UpdateTimers() { Timer.Count.Update(deltaTime); IncreaseBallVelocityTimer += deltaTime; SpawnPowerUpTimer += deltaTime; if (IncreaseBallVelocityTimer >= IncreaseBallVelocityInterval) { BallVelocity += 10; Balls.ForEach(b => { b.BaseVelocity = BallVelocity; b.Velocity = BallVelocity; }); IncreaseBallVelocityTimer = 0; } if (SpawnPowerUpTimer >= SpawnPowerUpInterval) { var randPowerup = new PowerUp(this, RandomMath.RandomEnum <PowerUpType>()); var randPosition = new Vector2() { X = RandomMath.RandomBetween(0, GlobalData.Screen.Width - SpriteData.PackageWidth), Y = 0 - SpriteData.PackageHeight, }; Packages.AddIfNotNull(ModelFactory.CreatePowerUpPackage(randPowerup, randPosition)); SpawnPowerUpTimer = 0; } }
public void Colision() { Ball Ball = getSelected(); if (!(Ball is null)) { int index = getSelectedIndex(Ball); for (int i = 0; i < Balls.Count; i++) { if (Ball.Equals(Balls[i])) { continue; } if (pointsDistance(Ball.Location, Balls[i].Location) < (Ball.Radius + Balls.ElementAt(i).Radius) && Ball.Color == Balls.ElementAt(i).Color) { Balls[index].isColiding = true; Balls[i].isColiding = true; } } for (int i = 0; i < Balls.Count; i++) { if (Balls[i].isColiding) { Balls.RemoveAt(i); i--; } } } }
/// <summary> /// Update physics and behaviour of all entities in the game /// </summary> public void Step(float elapsed) { deltaTime = elapsed; if (IsInGame) { UpdateTimers(); } foreach (var ball in Balls.ToList()) { HandleBall(ball); } foreach (var block in Map.Layer1.ToList()) { HandleBlock(block); } foreach (var package in Packages.ToList()) { HandlePackage(package); } foreach (var powerUp in PowerUps.ToList()) { HandlePowerUp(powerUp); } foreach (var explosion in ExplosiveZones.ToList()) { HandleExplosion(explosion); } }
public static string Looks(this List <Balls> parBalls, bool fluid = true) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < parBalls.Count; i++) { Balls balls = parBalls[i]; if (i == 0) { builder.Append(fluid ? balls.Look() : balls.LookWithOutFluid()); } else { builder.Append(fluid ? balls.Look(false) : balls.LookWithOutFluid(false)); } if (i == parBalls.Count - 2) { builder.Append(" and "); } else if (i == parBalls.Count - 1) { builder.Append("."); } else { builder.Append(", "); } } return(builder.ToString()); }
public void CanSwallow() { for (int i = 0; i < Count; ++i) { for (int j = i + 1; j < Count; ++j) { if (!Balls[i].IsTouching(Balls[j])) { continue; } if (Balls[i].Radius > Balls[j].Radius) { Balls[i].Counter++; Balls[j].Counter--; } else if (Balls[i].Radius < Balls[j].Radius) { Balls[i].Counter--; Balls[j].Counter++; } } } Balls.RemoveAll(ball => ball.Counter < 0); }
public override void LoadContent(IContentManager Content, Point windowSize) { var ballTexture = Content.Load <Texture2D>("ball2"); var paddle = Content.Load <Texture2D>("paddle"); var goal = Content.Load <Song>("goal"); var paddleRot = Content.Load <Texture2D>("paddleRot"); var deathSound = Content.Load <SoundEffect>("death"); var pew = Content.Load <SoundEffect>("pew"); var blip = Content.Load <SoundEffect>("blip"); var font = Content.Load <SpriteFont>("arial"); Engine.Load(new List <Texture2D>() { ballTexture }); for (int i = 0; i < 1; i++) { var gameTimer = new GameTimer { EveryNumOfSeconds = 3f }; var ball = new Ball(Randomizer1, gameTimer); Balls.Add(ball); } LoadGameMode(); LoadPlayers(font, paddle, goal, paddleRot, deathSound); LoadBalls(Balls, pew, blip, ballTexture, font); ResetGame(windowSize.X, windowSize.Y); SetPositions(windowSize.X, windowSize.Y); }
private void Start() { if (instance == null) { instance = this; } }
public void AddBall(int radius, int speed, string style, Point currentPosition, Point nextPosition, Point previousPosition = null) { Balls.Add(new Ball() { Radius = radius, Speed = speed, Style = style, CurrentPosition = currentPosition, NextPosition = nextPosition, PreviousPosition = previousPosition }); }
public override void EnterState(Balls ball) { // change of color ball.GetComponent <Renderer>().material.SetColor("_Color", activeColors[Random.Range(0, activeColors.Length)]); ball.tag = "Active"; ball.gameManager.activeBalls.Add(ball); }
// Update is called once per frame void Update() { if (handling) { return; } //Obtiene la velocidad maxima de todas las bolas maxv = mainBall.rb.velocity.sqrMagnitude; foreach (GameObject gobj in balls) { Balls bp = gobj.GetComponent <Balls>(); if (maxv < bp.rb.velocity.sqrMagnitude) { maxv = bp.rb.velocity.sqrMagnitude; } } palo.canPlay = (maxv < 0.01); //Detector de fin de turno if (inMov && palo.canPlay) { if (GAME_MODE == 8) { newTurn8(); } else if (GAME_MODE == 9) { newTurn9(); } } inMov = !palo.canPlay; }
protected static bool TakeShit_and_Cast(Vector3 position) { if (W.IsReady()) { if (W.ToggleState != 2 && !IsWHolding) { if (Balls.Any()) { return(W.Cast(Balls.FirstOrDefault())); } else { var minion = ObjectManager.Get <Obj_AI_Minion>().Where(x => x.IsValidTarget(W.Range) && x.IsEnemy).FirstOrDefault(); if (minion != null) { return(W.Cast(minion)); } } } if (W.ToggleState == 2 && IsWHolding && !IsHoldingPet) { W.Cast(position); } } return(false); }
public void Level6(Balls ballList) { Point p = ballList.deleteRed(); ballList.AddBall(new Ball(30, p.X, p.Y, 20, Color.Red)); ballList.changeBlue(); }
public void ConfirmAddBall() { var newBallName = SelectedBall.Name; // Validation if (SelectedBall.Name == null || SelectedBall.Name == "" || SelectedBall.Colour == null) { MessageBox.Show("Please give the new ball a name and a colour."); return; } crud.AddBall(SelectedBall); LoadBalls(); // This will not work if balls have the same name. Unfortunately SelectedBall = Balls.Where(b => b.Name == newBallName).FirstOrDefault(); txtBallNameEnabled = false; SelectedBallColourEnabled = false; AddBallButtonVisibility = Visibility.Visible; ConfirmAddBallButtonVisibility = Visibility.Collapsed; BallNameDataGridEnabled = true; ColourDataGridEnabled = true; DeleteButtonEnabled = true; EditButtonEnabled = true; }
public void AddBall() { var ball = new Ball(25, new Random(DateTime.Now.Millisecond).Next(360), 2); Balls.Add(ball); ball.Scored += ball_Scored; }
public void Reset() { _gameLoop.Stop(); Balls.Clear(); Paddles.Clear(); ScoreLeft = 0; ScoreRight = 0; }
public void Draw(Graphics g) { Balls.ForEach(ball => ball.Draw(g)); if (Bomb != null) { Bomb.Draw(g); } }
private void Shoot() { Vector3 position = transform.position; position.y += 0.5F; Balls newBalls = Instantiate(balls, position, balls.transform.rotation) as Balls; newBalls.Parent = gameObject; newBalls.Direction = newBalls.transform.right * (sprite.flipX ? 1.0F : -1.0F); }
public void removeBlack(Balls ballList) { for (int i = ballList.list.Count - 1; i >= 0; i--) { Ball b = ballList.list.ElementAt(i); ballList.list.ElementAt(i); } }
public void RemoveBalls() { foreach (IBall ball in Balls) { _drawer.Remove(ball); } Balls.Clear(); }
protected virtual LevelState GetState() { return(new LevelState() { Balls = Balls.Select(p => p.State).ToList(), GameMode = GameMode, PongPlayerStates = Players.Select(p => p.State).ToList() }); }
/// <summary> /// Победа /// </summary> /// <remarks> /// Вызывается после прохождения уровня /// </remarks> public static void Win() { Balls.ClearBalls(); Balls.AddSpeed(); Game.isMove = false; Game.isWin = true; Camera.main.GetComponent <Animator>().SetBool("Win", true); LevelManager.AddLevel(); }
void dropElement() { Balls lastOne = Repository.listOfBalls[Repository.listOfBalls.Count - 1]; Repository.listOfBalls.RemoveAt(Repository.listOfBalls.Count - 1); lastOne.gameObject.SetActive(true); lastOne.transform.position = player.transform.position + new Vector3(player.position.x - 0.2f, 0, player.position.z - 0.2f); Debug.Log("I am a childless Millenial"); }
public override string ToString() { var sb = new StringBuilder(); sb.AppendLine($"Balls: {string.Join(", ", Balls.Select(x => x.Value).OrderBy(x => x))}."); sb.AppendLine($"PowerBalls: {string.Join(", ", PowerBalls.Select(x => x.Value).OrderBy(x => x))}"); //sb.AppendLine($"Matched balls: {MatchedBalls}. Matched Powerballs: {MatchedPowerBalls}"); return(sb.ToString()); }