Esempio n. 1
0
        public bool FaceTarget(Actor self, Target target)
        {
            if (IsTraitDisabled || IsTraitPaused || attack == null || attack.IsTraitDisabled || attack.IsTraitPaused)
            {
                return(false);
            }

            var pos       = self.CenterPosition;
            var targetPos = attack.GetTargetPosition(pos, target);
            var delta     = targetPos - pos;

            DesiredFacing = delta.HorizontalLengthSquared != 0 ? delta.Yaw.Facing : TurretFacing;
            MoveTurret();
            return(HasAchievedDesiredFacing);
        }
Esempio n. 2
0
        public bool FaceTarget(Actor self, Target target)
        {
            if (IsTraitDisabled || IsTraitPaused || attack == null || attack.IsTraitDisabled || attack.IsTraitPaused)
            {
                return(false);
            }

            if (target.Type == TargetType.Invalid)
            {
                desiredDirection = null;
                return(false);
            }

            var turretPos = self.CenterPosition + Position(self);
            var targetPos = attack.GetTargetPosition(turretPos, target);

            desiredDirection = targetPos - turretPos;

            MoveTurret();
            return(HasAchievedDesiredFacing);
        }