private void RemoveTarget(Target t) { t.PhaserSound.audio.Stop(); LaserDrawer BD1 = t.LaserDrawer1; LineRenderer LR1 = t.LineRenderer1; LaserDrawer BD2 = t.LaserDrawer2; LineRenderer LR2 = t.LineRenderer2; LaserDrawer BD3 = t.LaserDrawer3; LineRenderer LR3 = t.LineRenderer3; LR1 = BD1.render(Vector3.zero, Color.blue); LR1.SetWidth(0, 0); LR1.SetPosition(0, Vector3.zero); LR1.SetPosition(1, Vector3.zero); LR2 = BD2.render(Vector3.zero, Color.magenta); LR2.SetWidth(0, 0); LR2.SetPosition(0, Vector3.zero); LR2.SetPosition(1, Vector3.zero); Color fc = new Color(0.469F, 0.484F, 0.371F, 0.8F); LR3 = BD3.render(Vector3.zero, fc); LR3.SetWidth(0, 0); LR3.SetPosition(0, Vector3.zero); LR3.SetPosition(1, Vector3.zero); this.TargetList.Remove(t); this.TargetIDList.Remove(t.targetID); }
internal void FirePhaser(Target t) { LaserDrawer BD1 = t.LaserDrawer1; LineRenderer LR1 = t.LineRenderer1; LaserDrawer BD2 = t.LaserDrawer2; LineRenderer LR2 = t.LineRenderer2; LaserDrawer BD3 = t.LaserDrawer3; LineRenderer LR3 = t.LineRenderer3; if (!t.PhaserSound.audio.enabled) { t.soundPitch = Mathf.Lerp(0.09f, 1f, t.PhaserYield / 500); t.PhaserSound.audio.pitch = t.soundPitch; } t.ship.GoOffRails(); Vessel Parent = FlightGlobals.ActiveVessel; Vector3 parentPosition_current = Parent.transform.localPosition; Vector3 childPosition_current = t.ship.transform.localPosition; float width = 0; // RENDER THE Phaser BEAM Vector3 PhaserBeamVector = parentPosition_current - childPosition_current; LR1 = BD1.render(PhaserBeamVector, Color.red); width = 1F; LR1.SetWidth(0.2F, width); LR1.SetPosition(0, parentPosition_current); LR1.SetPosition(1, childPosition_current); LR2 = BD2.render(PhaserBeamVector, Color.magenta); width = 0.3F; LR2.SetWidth(0.1F, width); LR2.SetPosition(0, parentPosition_current); LR2.SetPosition(1, childPosition_current); /* * Color fc = new Color(0.469F, 0.484F, 0.371F, 0.8F); * LR3 = BD3.render(PhaserBeamVector, fc,7); * LR3 = BD3.render(PhaserBeamVector, Color.magenta); * LR3.SetWidth(0.1F, 0.4F); * LR3.SetPosition(0, parentPosition_current); * for (int i = 1; i <= 5; i++) * { * var pos = Vector3.Lerp(parentPosition_current, childPosition_current, i / 5.0f); * * pos.x += rnd.Next(-4, 4)/10; * pos.y += rnd.Next(-4, 4)/10; * LR3.SetPosition(i, pos); * } * LR3.SetPosition(6, childPosition_current); * // RENDER THE Phaser BEAM */ float dist = Vector3.Distance(FlightGlobals.ActiveVessel.findWorldCenterOfMass(), t.ship.findWorldCenterOfMass()); foreach (var vesselPart in t.ship.parts.Where(p => p.rigidbody != null)) { vesselPart.temperature += t.PhaserYield * 2000 / dist * TimeWarp.deltaTime; } }