public void Update(Vector3 centropantalla, Matrix PM, Matrix VM, int screenWidth, int screenHeight, Camara camara) { this.facdesp = GameConstants.RapidezDesplazamiento / rapidez; this.posicion.Y = camara.CamTar.Y; if (skeleton != null) { this.posicion.Y += this.rapidez; if (this.active) { if (this.vida > 0) { Joint manoDerecha = skeleton.Joints[JointType.HandLeft]; Vector3 vector = new Vector3 { X = (manoDerecha.Position.X) * (rapidez * this.facdesp) * (screenWidth / 2), Y = (manoDerecha.Position.Y) * (rapidez * this.facdesp) * (screenHeight / 2) + (int)(Math.Floor(camara.CamPos.Y)), Z = 0.0f, }; this.posicion = vector; /*if (kstt.IsKeyUp(Keys.Left) && kstt.IsKeyUp(Keys.Right)) * { * this.RotacionY = 0.0f; * }*/ /*if (this.posicion.X > centropantalla.X - GameConstants.PlayfieldSizeX && manoDerecha.Position.X < 0) * { * this.posicion.X -= rapidez * this.facdesp; * if (this.RotacionY > -0.5f) this.RotacionY -= 0.10f; * } * else if (this.posicion.X < centropantalla.X + GameConstants.PlayfieldSizeX && manoDerecha.Position.X > 0) * { * this.posicion.X += rapidez * this.facdesp; * if (this.RotacionY < 0.5f) this.RotacionY += 0.10f; * } * else if (this.posicion.Y < centropantalla.Y + GameConstants.PlayfieldSizeY / 2 && manoDerecha.Position.Y > 0) * this.posicion.Y += rapidez * this.facdesp; * else if (this.posicion.Y > centropantalla.Y - GameConstants.PlayfieldSizeY / 2 && manoDerecha.Position.Y < 0) * this.posicion.Y -= rapidez * this.facdesp;*/ } else { this.active = false; } } } /*this.posicion.Y += this.rapidez; * if (this.active) * { * if (this.vida > 0) * { * KeyboardState kstt = Keyboard.GetState(); * * if (kstt.IsKeyDown(Keys.Space)) * { * if (sw.Elapsed.TotalMilliseconds > this.ddelay) * { * this.balas.Add(new Bala(this.rapdisparo, this.ddisparo, bmodelo, this.posicion, dirb, PM, VM)); * this.nuevodisparo = true; * sw.Restart(); * } * } * if (kstt.IsKeyUp(Keys.Left) && kstt.IsKeyUp(Keys.Right)) * { * this.RotacionY = 0.0f; * } * if (this.posicion.X > centropantalla.X - GameConstants.PlayfieldSizeX && kstt.IsKeyDown(Keys.Left)) * { * this.posicion.X -= rapidez * this.facdesp; * if (this.RotacionY > -0.5f) this.RotacionY -= 0.10f; * } * else if (this.posicion.X < centropantalla.X + GameConstants.PlayfieldSizeX && kstt.IsKeyDown(Keys.Right)) * { * this.posicion.X += rapidez * this.facdesp; * if (this.RotacionY < 0.5f) this.RotacionY += 0.10f; * } * else if (this.posicion.Y < centropantalla.Y + GameConstants.PlayfieldSizeY / 2 && kstt.IsKeyDown(Keys.Up)) * this.posicion.Y += rapidez * this.facdesp; * else if (this.posicion.Y > centropantalla.Y - GameConstants.PlayfieldSizeY / 2 && kstt.IsKeyDown(Keys.Down)) * this.posicion.Y -= rapidez * this.facdesp; * } * else * { * this.active = false; * } * }*/ for (int i = 0; i < balas.Count; i++) { if (balas.ElementAt(i).active) { balas.ElementAt(i).Update(centropantalla); } else { balas.RemoveAt(i); } } }