public EntryBawl(Group group, string name, Bawl bawl) : base(group, name, bawl) { m_Bawl = bawl; m_Width = (int)BawlSize.Huge + m_Group.PadX; m_Height = (int)BawlSize.Huge + m_Group.PadY; m_Key = m_Bawl.GetHashCode(); m_Brush = Renderer.InitializeGradientBrush( m_Group.EntryColor.Color, m_Group.X + m_Group.PadX, m_Group.Y + m_Group.PadY, m_Width, m_Height); }
public override void Execute(Entities.Pointer p) { if (p.Queue.Count == 0) { return; } MouseEventArgs e = (MouseEventArgs)p.Queue.Dequeue(); if (e.Button == MouseButtons.Left) { Entities.Bawl b = (Entities.Bawl)Entities.Pointer.NearestEntity; if (b != null) { b.Selected = !b.Selected; if (b.Selected) { Group group = Hud.Control.Instance.GetGroup("Bawls"); group.Add(new EntryBawl(group, b.ID.ToString(), b)); } else { if (Hud.Control.Instance.HasGroup("Bawls")) { Group group = Hud.Control.Instance.GetGroup("Bawls"); EntryGeneric entry = group.GetEntry(b.ID.ToString()); group.Remove(entry); } } } } else if (e.Button == MouseButtons.Right) { if (p.FSM.Global == Follow.Instance) { p.FSM.ChangeGlobal(null); } else { p.FSM.ChangeGlobal(Follow.Instance); } } }
public override void Execute(Entities.Pointer p) { MouseEventArgs m = null; if (p.Queue.Count != 0) { m = (MouseEventArgs)p.Queue.Dequeue(); } switch (s_Stage) { case Stage.ChoosePosition: if (m == null) { break; } s_Bawl = new Entities.Bawl( World.ToWorld(new Vector3D((double)m.X, (double)m.Y, 0)), new Vector3D(0, 0, 0), new Vector3D(0, 0, 0), new Vector3D(0, 0, 0), new Vector3D(0, 0, 0), UI.SelectedMass, UI.SelectedPen, UI.SelectedBrush, UI.SelectedSize); if (m.Button == MouseButtons.Left) { s_Stage = Stage.AddBawl; } else { s_Stage = Stage.SetVelocity; } break; case Stage.SetVelocity: Vector3D v = (p.Location - s_Bawl.Position) / Settings.VelocityVectorScale; v.Truncate(s_Bawl.MaxSpeed); s_Bawl.Render(); Renderer.DrawVector(World.ToLocal(s_Bawl.Position), v * Settings.VelocityVectorScale, Renderer.PenVelocity); if (m == null) { break; } if (m.Button == MouseButtons.Left) { s_Stage = Stage.AddBawl; } else if (m.Button == MouseButtons.Right) { s_Stage = Stage.SetAcceleration; } s_Bawl.Velocity = v; break; case Stage.SetAcceleration: Vector3D a = (p.Location - s_Bawl.Position) / Settings.AccelerationVectorScale; a.Truncate(s_Bawl.MaxAccel); s_Bawl.Render(); Renderer.DrawVector(World.ToLocal(s_Bawl.Position), s_Bawl.Velocity * Settings.VelocityVectorScale, Renderer.PenVelocity); Renderer.DrawVector(World.ToLocal(s_Bawl.Position), a * Settings.AccelerationVectorScale, Renderer.PenAcceleration); if (m == null) { break; } if (m.Button == MouseButtons.Left) { s_Stage = Stage.AddBawl; } else if (m.Button == MouseButtons.Right) { s_Stage = Stage.SetAngularVelocity; } s_Bawl.Acceleration = a; break; case Stage.SetAngularVelocity: Vector3D av = (p.Location - s_Bawl.Position) / Settings.VelocityVectorScale; av.Truncate(s_Bawl.MaxSpeed); s_Bawl.Render(); Renderer.DrawVector(World.ToLocal(s_Bawl.Position), s_Bawl.Velocity * Settings.VelocityVectorScale, Renderer.PenVelocity); Renderer.DrawVector(World.ToLocal(s_Bawl.Position), s_Bawl.Acceleration * Settings.AccelerationVectorScale, Renderer.PenAcceleration); Renderer.DrawVector(World.ToLocal(s_Bawl.Position), av * Settings.VelocityVectorScale, Renderer.PenAngularVelocity); if (m == null) { break; } if (m.Button == MouseButtons.Left) { s_Stage = Stage.AddBawl; } else if (m.Button == MouseButtons.Right) { s_Stage = Stage.SetAngularAcceleration; } s_Bawl.AngularVelocity = av; break; case Stage.SetAngularAcceleration: Vector3D aa = (p.Location - s_Bawl.Position) / Settings.AccelerationVectorScale; aa.Truncate(s_Bawl.MaxAccel); s_Bawl.Render(); Renderer.DrawVector(World.ToLocal(s_Bawl.Position), s_Bawl.Velocity * Settings.VelocityVectorScale, Renderer.PenVelocity); Renderer.DrawVector(World.ToLocal(s_Bawl.Position), s_Bawl.Acceleration * Settings.AccelerationVectorScale, Renderer.PenAcceleration); Renderer.DrawVector(World.ToLocal(s_Bawl.Position), s_Bawl.AngularVelocity * Settings.VelocityVectorScale, Renderer.PenAngularVelocity); Renderer.DrawVector(World.ToLocal(s_Bawl.Position), aa * Settings.AccelerationVectorScale, Renderer.PenAngularAcceleration); if (m == null) { break; } if (m.Button == MouseButtons.Left) { s_Stage = Stage.AddBawl; } s_Bawl.AngularAcceleration = aa; break; case Stage.AddBawl: s_Bawl.FSM.Change(State.Bawl.Float.Instance); Manager.Instance.Register(s_Bawl); World.AddVehicle(s_Bawl); s_Bawl = null; s_Stage = Stage.ChoosePosition; break; default: break; } }