Crux Gaming
Lucky Club Solitaire
Download the classic card game for your Android device now!

General Details

Play solitaire on your android device! Classic Klondike gameplay with 1 or 3 card draw options. Features easy to use touch and drag controls and leaderboards to compare your score to your friends.

Technical Details

- Developed in Unity and programmed in C#.
- Google Play Games for leaderboards.
- Sprite animations with optimized sprite sheets for minimal draw calls.
- AdMob for banner ads.
- Published on Google Play.


                        /**
                        * CardPile.cs
                        * Data and functionality for each card pile area.
                        * NicholusHuber@gmail.com
                        */
                        using System.Collections.Generic;
                        using JetBrains.Annotations;
                        using UnityEngine;

                        /// <summary>
                        /// A simple class containing data for each card pile area.
                        /// </summary>
                        public class CardPile : MonoBehaviour
                        {
                            /// <summary>
                            /// Local units to offset cards in a column when face down.
                            /// Adjust this to change spacing
                            /// </summary>
                            public const int LocalOffsetFaceDown = 15;

                            /// <summary>
                            /// Local units to offset cards in a column when face up.
                            /// Adjust the multiplier to adjust face up spacing.
                            /// </summary>
                            public static float LocalOffsetFaceUp
                            {
                                get { return LocalOffsetFaceDown*3.5f; }
                            }

                            /// <summary>
                            /// Local units to offset the cards by a little bit in the DeckUpPile
                            /// Adjust the multiplier to adjust spacing.
                            /// </summary>
                            public static float LocalOffsetDeckUpSmall
                            {
                                get { return LocalOffsetFaceDown * 0.15f; }
                            }

                            /// <summary>
                            /// Local units to offset cards in the DeckUp pile when flipping 3 cards at once.
                            /// Adjust the multiplier to adjust spacing.
                            /// </summary>
                            public static float LocalOffsetDeckUpLarge
                            {
                                get { return LocalOffsetFaceDown * 5f; }
                            }

                            /// <summary>
                            /// World units to offset cards in a column when face down.
                            /// Don't adjust these- it's just a local to world conversion.
                            /// </summary>
                            public static float WorldOffsetFaceDown
                            {
                                get { return LocalOffsetFaceDown*0.00135f; }
                            }

                            /// <summary>
                            /// World units to offset cards in a column when face up.
                            /// Don't adjust these- it's just a local to world conversion.
                            /// </summary>
                            public static float WorldOffsetFaceUp
                            {
                                get { return LocalOffsetFaceUp*0.00135f; }
                            }

                            /// <summary>
                            /// World units to offset cards in a DeckUp by a little.
                            /// Don't modify this.
                            /// </summary>
                            public static float WorldOffsetDeckUpSmall
                            {
                                get { return LocalOffsetDeckUpSmall * 0.005f; }
                            }

                            /// <summary>
                            /// World units to offset cards in a DeckUp by a lot.
                            /// Don't modify this.
                            /// </summary>
                            public static float WorldOffsetDeckUpLarge
                            {
                                get { return LocalOffsetDeckUpLarge * 0.00135f; }
                            }

                            /// <summary>
                            /// The 'name' attribute of the parent GameObject.
                            /// </summary>
                            public string Name;

                            /// <summary>
                            /// The Transform of the parent.
                            /// </summary>
                            public Transform Transform;

                            /// <summary>
                            /// The distance from this CardPile Transform to the dropped card. (Used when dragging a card.)
                            /// </summary>
                            public float Magnitude;

                            /// <summary>
                            /// List of the Transforms belonging to each card in this CardPile.
                            /// Don't directly modify, handled by the card.SetCardPile() function.
                            /// Note: Not protected due to the issues of deriving from a MonoBehaviour.
                            /// </summary>
                            public List<Transform> CardTs;

                            [UsedImplicitly]
                            private void Awake()
                            {
                                Name = gameObject.name;
                                Transform = transform;
                                CardTs = new List<Transform>();
                            }

                            /// <summary>
                            /// Returns the Vector3 world position of the piles drag target.
                            /// Drag target is the last card in the pile if there are any cards, otherwise it's the parent.
                            /// </summary>
                            /// <returns></returns>
                            public Vector3 GetWorldDragPos()
                            {
                                // if the pile is'DeckUp' return the transform for the first card, and a slightly offset x position for the rest.
                                if (Name == "DeckUp")
                                    return new Vector3(Transform.position.x, Transform.position.y - WorldOffsetDeckUpSmall);
                                // if this isn't a column pile, or if the pile is empty, return the pile position
                                if (Transform.parent.tag != "columns" || CardTs.Count == 0)
                                    return Transform.position;
                                // the last card's transform
                                var lastCardT = CardTs[CardTs.Count - 1];
                                // if the last card is face up return the position offset by OffsetFaceUp
                                // else return the position offset by OffsetFaceDown
                                return lastCardT.GetComponent<Card>().IsFaceUp
                                    ? new Vector2(lastCardT.position.x, lastCardT.position.y - WorldOffsetFaceUp)
                                    : new Vector2(lastCardT.position.x, lastCardT.position.y - WorldOffsetFaceDown);

                            }

                            /// <summary>
                            /// Returns the Vector3 local position of the piles drag target.
                            /// Drag target is the last card in the pile if there are any cards, otherwise it's the parent.
                            /// </summary>
                            /// <returns></returns>
                            public Vector3 GetLocalDragPos()
                            {
                                // if the pile is'DeckUp' return the transform for the first card, and a slightly offset x position for the rest.
                                if (Name == "DeckUp")
                                    return new Vector3(0, LocalOffsetDeckUpSmall);
                                if (Transform.parent.tag != "columns" || CardTs.Count <= 1)
                                    return Vector3.zero;
                                // if this isn't a column pile, or if the pile only has this card in it, return the pile position
                                var lastCardT = CardTs[CardTs.Count - 2];      // the card before this one's transform
                                return lastCardT.GetComponent<Card>().IsFaceUp // if that card is face up
                                    ? new Vector2(0, -LocalOffsetFaceUp)       // return the position offset by OffsetFaceUp
                                    : new Vector2(0, -LocalOffsetFaceDown);    // else return the position offset by OffsetFaceDown
                            }

                        }



                    
Copyright © Nicholus Huber / Crux Gaming