Beispiel #1
0
        public CounterMeasure(DPGameRunner runner, Ship.Ship owner, CounterMeasureDropperArchetype gun_arch,
                              ShipItem launcher, uint hpid)
            : base(runner)
        {
            munition_arch = gun_arch.ProjectileArch as CounterMeasureArchetype;
            Arch          = munition_arch;

            Position    = owner.InterpolatedPosition();
            Position   += owner.Orientation * owner.Arch.Hardpoints[launcher.hpname.ToLowerInvariant()].Position;
            Orientation = Matrix.TurnAround(owner.Orientation);
            velocity    = Orientation * gun_arch.MuzzleVelocity + owner.EstimatedVelocity;
            owner_objid = owner.Objid;
            this.hpid   = hpid;

            lifetime        = munition_arch.Lifetime;
            owner_safe_time = munition_arch.OwnerSafeTime;

            Throttle = 1; // (float)(this.velocity.Length() / this.max_speed);

            angular_velocity = new Vector(rand.NextDouble() * 10 - 5, rand.NextDouble() * 10 - 5, rand.NextDouble() * 10 - 5);
        }
Beispiel #2
0
        public Missile(DPGameRunner runner, Ship.Ship owner, GunArchetype gun_arch, ShipItem launcher, Vector target_position,
                       uint hpid)
            : base(runner)
        {
            munition_arch = gun_arch.ProjectileArch as MunitionArchetype;
            Arch          = munition_arch;

            Position        = owner.InterpolatedPosition();
            Position       += owner.Orientation * owner.Arch.Hardpoints[launcher.hpname.ToLowerInvariant()].Position;
            Orientation     = Matrix.CreateLookAt(Position, target_position);
            velocity        = Orientation * gun_arch.MuzzleVelocity + owner.EstimatedVelocity;
            owner_objid     = owner.Objid;
            target_objid    = owner.TargetObjID;
            target_subobjid = owner.target_subobjid;
            this.hpid       = hpid;

            lifetime = munition_arch.Lifetime;

            motor_accel        = munition_arch.MotorArch.Accel;
            motor_lifetime_max = motor_lifetime = munition_arch.MotorArch.Lifetime;
            motor_delay        = munition_arch.MotorArch.Delay;

            seek = (munition_arch.Seeker.ToUpper() == "LOCK") && (target_objid != 0);
            if (seek)
            {
                seeker_fov   = munition_arch.SeekerFovDeg * Math.PI / 180;
                seeker_range = munition_arch.SeekerRange;

                time_to_lock         = munition_arch.TimeToLock;
                max_angular_velocity = munition_arch.MaxAngularVelocity * Math.PI / 180;
            }

            max_speed = velocity.Length() + motor_accel * motor_lifetime_max;

            Throttle = 1; // (float)(this.velocity.Length() / this.max_speed);
        }