Пример #1
0
        /// <summary>
        /// Dynamical rotation with a fraction delta differences for better visual effect, supporting both kinds of vertical orientation types of an Actor.
        /// </summary>
        /// <param name="owner">rotated Actor, his Angle gets automatically updated if he is IAngle</param>
        /// <param name="verticalOrientation">orientation of the actor, UP by default, DOWN for inversed logic</param>
        /// <param name="angleDeltaCount">number of required acts before the rotation reaches its peak and no longer has any new effect in the same direction</param>
        /// <param name="maxAngleDegrees">maximum allowed rotation angle before further movement in the same direction has no effect</param>
        public AbstractRotation(IActor owner, SpaceDirection.VerticalDirection verticalOrientation, int angleDeltaCount, int maxAngleDegrees)
        {
            Owner = owner;
            VerticalOrientation = verticalOrientation;
            if (angleDeltaCount == 0)
            {
                throw new ArgumentOutOfRangeException(nameof(angleDeltaCount), "Value of zero required acts isn't supported due to division. Did you mean one?");
            }
            AngleDeltaCount = angleDeltaCount;
            MaxAngleDegrees = maxAngleDegrees;

            //Angle can be initialized from the Actor's current state
            if (owner is IAngle)
            {
                CurrentRelativeAngleRadians = DegreesToRadians(((IAngle)owner).Angle);
            }

            //Maximum rotation angle
            MaxAngle = DegreesToRadians(maxAngleDegrees);

            //Delta is a fraction of MaxAngle
            DeltaAngle = MaxAngle / angleDeltaCount;
        }
 public FlyingDirectionRotation(IActor owner, SpaceDirection.VerticalDirection verticalOrientation, int angleDeltaCount, int maxAngleDegrees)
     : base(owner, verticalOrientation, angleDeltaCount, maxAngleDegrees)
 {
 }
Пример #3
0
 public TargetActorAngleRotation(IActor owner, IActor target, SpaceDirection.VerticalDirection verticalOrientation, int angleDeltaCount, int maxAngleDegrees)
     : base(owner, verticalOrientation, angleDeltaCount, maxAngleDegrees)
 {
     Target = target;
 }
Пример #4
0
 protected AbstractMovementThrust(IActor owner, SpaceDirection.VerticalDirection verticalOrientation, int blinkPeriod) : base(owner, "Thrust")
 {
     VerticalOrientation = verticalOrientation;
     BlinkPeriod         = blinkPeriod;
 }