public LineOverlay CreateLineOverlay(LineStyleInfo styleInfo) { var paint = MapquestStyleFactory.CreatePaintFromStyleInfo(styleInfo); var lineOverlay = new LineOverlay(paint); // get from styleInfo var paint1 = new Paint(PaintFlags.AntiAlias); paint1.StrokeWidth = styleInfo.StrokeWidth; paint1.Alpha = 100; paint1.Color = new Color(0, 0, 0, 255); lineOverlay.SetShowPoints(true, paint1); return(lineOverlay); }
/// <summary> /// Constructor de la clase. /// </summary> /// <param name="World">Referencia a la instancia del simulador al que se asociara el rayo.</param> /// <param name="Source">Punto de origen del rayo.</param> public RayTracer(World World) { this.World = World; this.Source = Vector2.Zero; this.line = new LineOverlay(); this.line.Color = Color.Red; }
public override void Update(GameTime gameTime) { if ((bool)Manager.Vars["showMessagePause"] == true) { return; } // Controlamos el tiempo de invicibilidad incluso habiendo pausa: if (this.invincibleTimer.Value >= 1000 && this.invincibleTime > 0) { this.invincibleTimer.Reset(); this.invincibleTime--; if (this.invincibleTime == 0) { this.box.Trigger = false; } } // Si se modifico algun parametro principal de la logica reconfiguramos el resto de valores: if (!this.isSetup) { switch (this.behavior) { case 1: // Horizontal this.direction = !this.reversePathAtStart ? 0 : 180; break; case 2: // Vertical this.direction = !this.reversePathAtStart ? 90 : 270; break; case 3: // Diagonal 1 (\) this.direction = !this.reversePathAtStart ? 45 : 225; break; case 4: // Diagonal 2 (/) this.direction = !this.reversePathAtStart ? 135 : 315; break; } this.a = this.Location; this.b = MathTools.Move(this.a, this.pathLength, this.direction); this.linePath = new LineOverlay(a, b, Color.Red); this.isSetup = true; } if (this.IsReady) { // Si esta muerto y puede resucitar... // Controlamos el tiempo de resurreccion incluso habiendo pausa: if ((this.IsDead && this.Respawn) && (this.respawnTimer.Value >= 1000 && this.respawnTime > 0)) { this.respawnTimer.Reset(); this.respawnTime--; if (this.respawnTime == 0) { this.IsDead = false; } } else if (this.behavior > 0) // Si no es estatico actualizamos su movimiento. { // Cuando la distancia de {a - location} sea mayor o igual que {a - b} cambiamos invertimos la direccion: if (Vector2.Distance(this.a, this.Location) >= Vector2.Distance(this.a, this.b)) { Helper.Swap <Vector2>(ref this.a, ref this.b); this.direction = MathTools.GetAngle(this.a, this.b); } this.box.Move(this.Step, this.direction); } } this.enemy.Location = this.Location; this.enemy.Flag = this.Invincible; this.enemy.Update(gameTime); this.shield.Update(gameTime); if (Invincible) { shield.Visible = true; shield.Enabled = true; shield.Angle += 0.5f; if (shield.Angle > 360) { shield.Angle = 0; } shield.Location = this.Location + box.Size / 2; } else { shield.Visible = false; shield.Enabled = false; } }