コード例 #1
0
        public override bool Tick(Actor self)
        {
            var d = targetPos - self.CenterPosition;

            // The next move would overshoot, so consider it close enough
            var move = sbm.FlyStep(sbm.Facing);

            // Destruct so that Explodes will be called
            if (d.HorizontalLengthSquared < move.HorizontalLengthSquared)
            {
                Queue(new CallFunc(() => self.Kill(self)));
                return(true);
            }

            FlyToward(self, sbm);
            ticks++;
            return(false);
        }
コード例 #2
0
        public override bool Tick(Actor self)
        {
            var d    = targetPos - self.CenterPosition;
            var move = bm.FlyStep(bm.Facing);

            if (d.HorizontalLengthSquared < move.HorizontalLengthSquared)
            {
                // Snap to the target position to prevent overshooting.
                bm.SetPosition(self, targetPos);
                Queue(new CallFunc(() => self.Kill(self, bm.Info.DamageTypes)));
                return(true);
            }

            var pos = WPos.LerpQuadratic(initPos, targetPos, bm.Info.LaunchAngle, ticks, length);

            bm.SetPosition(self, pos);
            bm.Facing = GetEffectiveFacing();

            ticks++;
            return(false);
        }