public void FlyToward(Actor self, BallisticMissile sbm)
        {
            var pos = WPos.LerpQuadratic(initPos, targetPos, sbm.Info.LaunchAngle, ticks, length);

            sbm.SetPosition(self, pos);
            sbm.Facing = GetEffectiveFacing();
        }
        public BallisticMissileFly(Actor self, Target t, BallisticMissile bm)
        {
            this.bm   = bm;
            bmInfo    = bm.Info;
            initPos   = self.CenterPosition;
            targetPos = t.CenterPosition;

            horizontalLength = (initPos - targetPos).HorizontalLength;

            if (bmInfo.LaunchAcceleration == WDist.Zero)
            {
                speed  = bmInfo.Speed.Length;
                dSpeed = 0;
            }
            else
            {
                speed  = 0;
                dSpeed = bmInfo.LaunchAcceleration.Length;
            }

            if (bmInfo.LazyCurve)
            {
                lazyCurveLength = Math.Max((targetPos - initPos).Length / this.bm.Info.Speed.Length, 1);
            }

            preparePitchIncrement = new WAngle((bmInfo.LaunchAngle - bmInfo.CreateAngle).Angle / bmInfo.PrepareTick);

            if (bmInfo.WithoutCruise)
            {
                preparePitchIncrement = new WAngle((new WAngle(256) - bmInfo.CreateAngle).Angle / bmInfo.PrepareTick);
            }
            bm.Pitch = bmInfo.CreateAngle;
        }
示例#3
0
 public BallisticMissileFly(Actor self, Target t, BallisticMissile bm)
 {
     this.bm   = bm;
     initPos   = self.CenterPosition;
     targetPos = t.CenterPosition;
     length    = Math.Max((targetPos - initPos).Length / this.bm.Info.Speed, 1);
     facing    = (targetPos - initPos).Yaw;
 }
        public BallisticMissileFly(Actor self, Target t, BallisticMissile sbm = null)
        {
            if (sbm == null)
            {
                this.sbm = self.Trait <BallisticMissile>();
            }
            else
            {
                this.sbm = sbm;
            }

            initPos   = self.CenterPosition;
            targetPos = t.CenterPosition;             // fixed position == no homing
            length    = Math.Max((targetPos - initPos).Length / this.sbm.Info.Speed, 1);
            facing    = (targetPos - initPos).Yaw;
        }