示例#1
0
        public ArmorPiercingProjectile(RailgunFireData fireData, RailgunProjectileData projectileData)
        {
            // Weapon data
            _tracerColor     = projectileData.ProjectileTrailColor;
            _lineColor       = new Vector4(_tracerColor, 1f);
            _tracerScale     = projectileData.ProjectileTrailScale;
            _maxTrajectory   = projectileData.MaxTrajectory;
            _projectileSpeed = projectileData.DesiredSpeed;
            _deviationAngle  = projectileData.DeviationAngle;
            _gunEntityID     = projectileData.ShooterID;

            // Config data
            _drawTrail         = RailgunCore.MyConfig.DrawProjectileTrails;
            _explosionDamage   = RailgunCore.MyConfig.ExplosionDamage;
            _explosionRadius   = RailgunCore.MyConfig.ExplosionRadius;
            _penetrationDamage = RailgunCore.MyConfig.PenetrationDamage;
            _penetrationRange  = RailgunCore.MyConfig.PenetrationRange;
            _shouldExplode     = RailgunCore.MyConfig.ShouldExplode;
            _shouldPenetrate   = RailgunCore.MyConfig.ShouldPenetrate;

            // Fire data
            var temp = fireData.Direction;

            _direction           = Vector3D.IsUnit(ref temp) ? temp : Vector3D.Normalize(temp);
            _direction           = GetDeviatedVector(_direction, _deviationAngle);
            _origin              = fireData.Origin;
            _position            = _origin;
            _velocity            = fireData.ShooterVelocity + _direction * _projectileSpeed;
            _lastVelocity        = _velocity;
            _lastPositionChecked = _origin;

            _trajectoryPoints.Add(_position);
        }
示例#2
0
        public ArmorPiercingProjectileSimulation(RailgunFireData fireData, RailgunProjectileData projectileData)
        {
            //weapon data
            _tracerColor       = projectileData.ProjectileTrailColor;
            _lineColor         = new Vector4(_tracerColor, 1f);
            _tracerScale       = projectileData.ProjectileTrailScale;
            _drawTracer        = projectileData.DrawTracer;
            _shouldPenetrate   = projectileData.Penetrate;
            _shouldExplode     = projectileData.Explode;
            _penetrationDamage = projectileData.PenetrationDamage;
            _penetrationRange  = projectileData.PenetrationRange;
            _explosionRadius   = projectileData.ExplosionRadius;
            _explosionDamage   = projectileData.ExplosionDamage;
            _maxTrajectory     = projectileData.MaxTrajectory;
            _projectileSpeed   = projectileData.DesiredSpeed;

            //fire data
            var temp = fireData.Direction;

            _direction        = Vector3D.IsUnit(ref temp) ? temp : Vector3D.Normalize(temp);
            _origin           = fireData.Origin;
            _position         = _origin;
            _gunEntityID      = 0;
            _velocityCombined = fireData.ShooterVelocity + _direction * _projectileSpeed;
        }