public ArmorPiercingProjectileClient(RailgunTracerData tracerData, RailgunProjectileData projectileData) { //weapon data _tracerColor = projectileData.ProjectileTrailColor; _tracerScale = projectileData.ProjectileTrailScale; //tracer data _lineColor = tracerData.LineColor; _from = tracerData.LineFrom; _to = tracerData.LineTo; _direction = tracerData.ProjectileDirection; _drawTracer = tracerData.DrawTracer; _drawTrail = tracerData.DrawTrail; }
public List <RailgunTracerData> GetTracerData() { _tracerData.Clear(); RailgunTracerData thisTracer; if (_trajectoryPoints.Count == 0) { return(_tracerData); } // Draw projectile trail if (_drawTrail) { for (int i = 0; i < _trajectoryPoints.Count - 1; i++) { var start = _trajectoryPoints[i]; var end = _trajectoryPoints[i + 1]; thisTracer = new RailgunTracerData() { ShooterID = _gunEntityID, DrawTracer = false, LineColor = _lineColor, LineFrom = start, LineTo = end, ProjectileDirection = Vector3D.Zero, DrawTrail = true, }; _tracerData.Add(thisTracer); } } Vector3D trailStart = _trajectoryPoints[_trajectoryPoints.Count - 1]; // Get important bullet parameters float lengthMultiplier = 40f * _tracerScale; lengthMultiplier *= 0.8f; var startPoint = _position - _direction * lengthMultiplier; bool shouldDraw = false; if (lengthMultiplier > 0f && !_targetHit && Vector3D.DistanceSquared(_position, _origin) > lengthMultiplier * lengthMultiplier && !Killed) { shouldDraw = true; } thisTracer = new RailgunTracerData() { ShooterID = _gunEntityID, DrawTracer = shouldDraw, DrawTrail = _drawTrail, LineColor = _lineColor, LineFrom = trailStart, LineTo = _targetHit ? _hitPosition : _position, ProjectileDirection = _direction, }; _tracerData.Add(thisTracer); return(_tracerData); }