Пример #1
0
        private void AttachingBlock()
        {
            MoveTowards(targetPosition);

            var targetVector     = targetPosition - transform.position;
            var distanceToTarget = targetVector.magnitude;

            if (distanceToTarget < 2.2f)
            {
                if (ship.HasFreeJoints())
                {
                    blockHolder.AttachHoldingBlockToBase(ship);
                    state = State.Thinking;
                }
                else
                {
                    var holdingBlock = blockHolder.GetHoldingBlock();
                    blockHolder.ReleaseHoldingBlock();

                    var otherBlock = BlockManager.GetOtherFreeBlockClosestTo(transform.position, holdingBlock);
                    StartGettingBlock(otherBlock);
                }
            }
        }