Exemplo n.º 1
0
        /// <summary>Set position to be attached by a given outgoing attachment. Does not set animation.</summary>
        public void SetAttachedPosition(Actor owner, OutgoingAttachment outgoingAttachment)
        {
            var tagFlip = owner.facingLeft != this.facingLeft;

            var attachmentContext = outgoingAttachment.targetAttachmentContext.MaybeFlip(tagFlip);
            var incomingPosition  = this.currentAnimation.CurrentFrame.incomingAttachments[attachmentContext].MaybeFlipX(this.facingLeft);
            var outgoingPosition  = outgoingAttachment.position.MaybeFlipX(owner.facingLeft);

            this.position = owner.position + (outgoingPosition - incomingPosition);
        }
Exemplo n.º 2
0
        public OutgoingAttachmentView(OutgoingAttachment sourceAttachment, Position sourcePosition, bool sourceFlipX)
        {
            attachment = sourceAttachment;
            facingLeft = sourceFlipX;
            position   = sourcePosition;

            if (sourceAttachment != null)
            {
                position += sourceAttachment.position.MaybeFlipX(sourceFlipX);

                attachRange = sourceAttachment.attachRange;
                if (sourceFlipX)
                {
                    attachRange.FlipXInPlace();
                }
            }
            else
            {
                attachRange = default(AABB);
            }

            attachRange += position;
        }