예제 #1
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);
        }
예제 #2
0
파일: Ship.cs 프로젝트: Friendly0Fire/flos
 public GunSim(Ship ship, ShipItem item)
 {
     this.ship = ship;
     this.item = item;
     arch      = item.arch as GunArchetype;
 }