/// /// Draws the scene to the spritebatch. /// /// <param name="spriteBatch">The target spritebatch.</param> public void Draw(SpriteBatch spriteBatch) { // Draw entities. paddle.Draw(spriteBatch); level.Draw(spriteBatch); foreach (Ball b in balls) { b.Draw(spriteBatch); } foreach (PowerUp PU in PowerUps) { PU.Draw(spriteBatch); } // Format and draw the display. string time = String.Format("Time: {0}:{1:D2}", (int)Math.Floor(timeLeft / 60), (int)timeLeft % 60); spriteBatch.DrawString(font, time, new Vector2(5, 4), (timeLeft < 60 && (int)timeLeft % 2 == 0) ? Color.DarkCyan : Color.LightBlue); string score = String.Format("Score: {0:D6}", player.Score); spriteBatch.DrawString(font, score, new Vector2(164, 4), Color.WhiteSmoke); string lives = String.Format("Lives: {0}", player.Lives); spriteBatch.DrawString(font, lives, new Vector2(370, 4), Color.Red); if (paused) { spriteBatch.DrawString(hsfont, "PAUSED", new Vector2(165, 180), Color.Red); spriteBatch.DrawString(font, "Press 'Space' to continue...", new Vector2(94, 224), Color.Red); } }
public bool Add(PU pu) { if (count >= space) { return(false); } bool stop = false; int i = 0; while (i < space && !stop) { if (pus[i] == null) { pus[i] = pu; count++; stop = true; } else { i++; } } slots[i].AddPU(pus[i]); return(true); }
public void ActivatePU(PU pu) { if (pu.name == "casc") { //gameObject.GetComponent<Animator>().SetBool("helmet", true); ActivateCasc(true); } else if (pu.name == "molles") { teMolles = true; Slids.instance.AddSlider(pu); } else if (pu.name == "pildora") { tePildora = true; Slids.instance.AddSlider(pu); soundManager.PlaySound("getPildora"); } else if (pu.name == "relantitzador") { if (!teRelan) { teRelan = true; spawnerH.instance.speed *= 0.5f; spawnerH.instance.respawnTime *= 2.0f; DayNightCicle.instance.sunAngleSpeed *= 0.5f; DayNightCicle.instance.moonAngleSpeed *= 0.5f; soundManager.PlaySound("clock"); } Slids.instance.AddSlider(pu); } }
public void Draw(SpriteBatch spriteBatch) { foreach (PowerUp PU in powerups) { PU.Draw(spriteBatch); } }
private void ClearPU() { puActive = false; UsePU(false); localPu = PU.NO_PU; GameManager.Instance.ChangePowerupIcon(); hasPU = false; t = 0; }
public void AddPU(PU newPU) { soundManager.PlaySound("addPU"); pu = newPU; icon.sprite = pu.icon; icon.enabled = true; scaleIncrease = 0.2f; icon.transform.localScale = new Vector3(0f, 0f, 0.01f); waving = false; icon.transform.eulerAngles = new Vector3(0f, 0f, Mathf.Cos(Inventory.instance.angleRot * Mathf.Deg2Rad) * 15f); }
private void OnTriggerEnter2D(Collider2D collision) { Powerup pu; if (collision.tag == "Obstacle") { Death(collision); } else if (pu = collision.GetComponent <Powerup>()) { if (pu.size <= size) { switch (pu.powerUp) { case PU.INFLATE: ChangeSize(true); break; case PU.DEFLATE: ChangeSize(false); break; case PU.SHIELD: ShieldPU(true); break; case PU.ROCKET: case PU.AK47: case PU.RAY_GUN: if (!hasPU) { hasPU = true; localPu = pu.powerUp; puTimer = pu.timer; akAmmo = pu.akAmmo; } break; default: break; } GameManager.Instance.ChangePowerupIcon(); Destroy(collision.gameObject); } else { Death(collision); } } }
public void Activate(PU newPU) { slidColor.r = 148; slidColor.b = 246; slidColor.g = 255; slidColor.a = 196; fill.color = slidColor; slider.gameObject.SetActive(true); pu = newPU; activated = true; handler.GetComponent <Image>().sprite = pu.icon; slider.maxValue = pu.time; slider.value = pu.time; slider.minValue = 0.0f; }
private void compararPrecioUnitario() { var resultado = MessageBoxResult.No; String consulta; if (modifica == false) { consulta = "select p.costo from productos p where p.idProductos = " + ltsProductos.SelectedValue + " "; } else { consulta = "SELECT t1.PUPagado FROM productos_has_ordencompra t1 where FK_idOC = " + idOC + " and t1.FK_idProducto = " + ltsProductos.SelectedValue + " "; } String valor = conexion.ValorEnVariable(consulta); float.TryParse(txtPrecioUnitario.Text, out float PU); float.TryParse(valor, out float PUOriginal); if (PUOriginal != PU) { if (!modifica) { resultado = MessageBox.Show("¿Quiere actualizar el precio unitario en el producto?", "Advertencia", MessageBoxButton.YesNo, MessageBoxImage.Warning); } else { resultado = MessageBoxResult.Yes; } if (resultado == MessageBoxResult.Yes) { if (modifica != true) { consulta = "UPDATE productos SET costo = '" + PU.ToString().Replace(",", ".") + "' where idProductos = " + ltsProductos.SelectedValue + " "; } else { consulta = "UPDATE productos_has_ordencompra SET PUPagado = '" + PU.ToString().Replace(",", ".") + "' where FK_idOC = " + idOC + " and FK_idProducto = " + ltsProductos.SelectedValue + " "; } conexion.operaciones(consulta); } } }
/// <summary> /// Function used to group Plan DVH with Uncertainty DVHs and retun the set as a list of curves. /// </summary> /// <param name="IP"></param> /// <param name="ST"></param> /// <returns></returns> public List <curve> GetDVHDataWithUncertainties(IonPlanSetup IP, Structure ST, VolumePresentation VP, DoseValuePresentation DP, double BinWidth) { List <curve> Curves = new List <curve>(); curve temp_curve = new curve(); temp_curve.Id = "U0"; temp_curve.DoseValuePresentation = DP; temp_curve.VolumePresentation = VP; temp_curve.StructureName = ST.Id; temp_curve.AbsoluteStructureVolume = ST.Volume; temp_curve.PrescribedDose = IP.TotalDose.Dose / IP.TreatmentPercentage; temp_curve.CurveData = IP.GetDVHCumulativeData(ST, temp_curve.DoseValuePresentation, temp_curve.VolumePresentation, BinWidth).CurveData; Curves.Add(temp_curve); if (IP.PlanUncertainties.Count() != 0) { foreach (PlanUncertainty PU in IP.PlanUncertainties) { try { temp_curve = new curve(); temp_curve.Id = PU.Id; temp_curve.IsocenterShift = PU.IsocenterShift; temp_curve.DoseValuePresentation = DP; temp_curve.VolumePresentation = VP; temp_curve.StructureName = ST.Id; temp_curve.AbsoluteStructureVolume = ST.Volume; temp_curve.PrescribedDose = IP.TotalDose.Dose / IP.TreatmentPercentage; temp_curve.CalibrationCurveError = PU.CalibrationCurveError; temp_curve.DisplayName = PU.DisplayName; temp_curve.CurveData = PU.GetDVHCumulativeData(ST, temp_curve.DoseValuePresentation, temp_curve.VolumePresentation, BinWidth).CurveData; Curves.Add(temp_curve); } catch { } } } return(Curves); }
public bool AddSlider(PU puAdd) { pu = puAdd; if (IsFull()) { return(false); } bool stop = false; int i = 0; while (i < maxSliders && !stop) { if (sliders[i].isForPU(pu)) { sliders[i].Activate(pu); stop = true; } else { i++; } } i = 0; while (i < maxSliders && !stop) { if (!sliders[i].isVisible()) { sliders[i].Activate(pu); nSliders++; stop = true; } else { i++; } } return(stop); }
public void DeactivatePU(PU pu) { if (pu.name == "casc") { ActivateCasc(false); } else if (pu.name == "molles") { teMolles = false; } else if (pu.name == "pildora") { tePildora = false; } else if (pu.name == "relantitzador") { teRelan = false; spawnerH.instance.speed *= 2.0f; spawnerH.instance.respawnTime *= 0.5f; DayNightCicle.instance.sunAngleSpeed *= 2.0f; DayNightCicle.instance.moonAngleSpeed *= 2.0f; } }
public bool CanUsePU(PU pu) { if (pu.name == "casc") { return(!teCasc); } else if (pu.name == "molles") { return(true); } else if (pu.name == "pildora") { return(true); } else if (pu.name == "relantitzador") { return(true); } else { return(true); } }
public void Update() { if (sound == 1) { EnemyShot.Play(); sound = 0; } else if (sound == 2) { Explosion.Play(); sound = 0; } else if (sound == 3) { BossExplosion.Play(); sound = 0; } else if (sound == 4) { PU.Play(); sound = 0; } }
/// /// Loads the sprites and sound effects from the project content. /// /// <param name="c">Project Content</param> public void Load(ContentManager c) { content = c; paddle.Load(c); level.Load(c); level.OnBlockCollision += OnCollision; font = c.Load <SpriteFont>("font"); hsfont = c.Load <SpriteFont>("hsfont"); blockDest = c.Load <SoundEffect>("BlockDestroyed"); pUpBigger = c.Load <SoundEffect>("Bigger"); pDownSmaller = c.Load <SoundEffect>("Smaller"); pDownFast = c.Load <SoundEffect>("Fast"); blockHit = c.Load <SoundEffect>("BlockHit"); pUpExtraBall = c.Load <SoundEffect>("ExtBall"); pUpExtraLife = c.Load <SoundEffect>("ExtLife"); foreach (Ball b in balls) { b.Load(c); } foreach (PowerUp PU in PowerUps) { PU.Load(c); } }
public bool isForPU(PU _pu) { return(isVisible() && _pu.name == pu.name); }
public void ClearSlot() { pu = null; icon.sprite = null; icon.enabled = false; }
public void OnPUCollected(PU pu) { puSpawned = false; ship.SwitchState(shipStatePool.shipStates[(int)pu]); }