Beispiel #1
0
    public PyramidFloorBoardElement[] CornerPointsForColor(MeepleColor color)
    {
        int idx1, idx2;

        switch (color)
        {
        case MeepleColor.Red:
            idx1 = floors[0].cornerIndices[0];
            idx2 = floors[0].cornerIndices[1];
            break;

        case MeepleColor.White:
            idx1 = floors[0].cornerIndices[2];
            idx2 = floors[0].cornerIndices[3];
            break;

        case MeepleColor.Green:
            idx1 = floors[0].cornerIndices[4];
            idx2 = floors[0].cornerIndices[5];
            break;

        case MeepleColor.Black:
            idx1 = floors[0].cornerIndices[6];
            idx2 = floors[0].cornerIndices[7];
            break;

        default:
            idx1 = floors[0].cornerIndices[0];
            idx2 = floors[0].cornerIndices[1];
            break;
        }
        return(new PyramidFloorBoardElement[] { floors[0].elements[idx1], floors[0].elements[idx2] });
    }
Beispiel #2
0
 /**
  * AI extends player, and has custom Prediction depending on difficulty
  */
 public AI(GameRunner gameRunner, MeepleColor meepleColor, int difficulty) : base(meepleColor: meepleColor)
 {
     this.GameRunner = gameRunner;
     this.Rand       = new System.Random();
     this.Predict    = RandomPrediction;
     this.ChangeDifficulty(difficulty);
     this.heuristic = BasicHeuristFunction;
 }
Beispiel #3
0
    public void UnClaimColor(MeepleColor color)
    {
        Console.WriteLine("unclaiming {0}", color.ToString());

        if (PlayerManager.Instance().local.isLobbyHost)
        {
            available.Add(color);
        }
    }
Beispiel #4
0
 public Meeple(MeepleColor meepleColor, Player owner)
 {
     this.MeepleId        = Meeple.MeepleMaxId++;
     this.MeepleColor     = meepleColor;
     this.MeeplePlacement = null;
     this.PlacementId     = -1;
     this.MeeplePoints    = 0;
     this.Owner           = owner;
 }
        /**
         * returns player with given color, or null if it doesn't exist
         */
        public Player GetPlayer(MeepleColor color)
        {
            var playerIndex = (int)color;

            if (playerIndex > this.PlayerList.Count)
            {
                return(null);
            }
            return(this.PlayerList[playerIndex]);
        }
Beispiel #6
0
    /// <summary>
    /// When color is sure to be free.
    /// Only issued by lobby host.
    /// Received by anyone
    /// </summary>
    public void ClaimColor(string playerUID, MeepleColor color)
    {
        Console.WriteLine("claiming {0} for {1}", color.ToString(), playerUID);
        GhostPlayer targetPlayer = PlayerManager.Instance().GetByUID(playerUID);

        targetPlayer.MeepleColor    = color;
        targetPlayer.colorIsClaimed = true;
        NotifyObservers();

        if (PlayerManager.Instance().local.isLobbyHost)
        {
            available.Remove(color);
        }
    }
Beispiel #7
0
    /// <summary>
    /// Handling color request.
    /// Only for lobby host.
    /// </summary>
    public void TryClaim(string playerUID, MeepleColor color)
    {
        if (PlayerManager.Instance().local.isLobbyHost)
        {
            Console.WriteLine("i am lobby host, i have color power");

            if (available.Contains(color))
            {
                // send word to all other players and claim color
                ColorClaimedCommand cmd = new ColorClaimedCommand(playerUID, (int)color);
                PlayerManager.Instance().local.HandleInput(cmd, true);
            }
            else if (available.Count > 0)
            {
                Console.WriteLine(color.ToString() + " not available, claiming next");
                TryClaimNext(playerUID);
            }
            else
            {
                Console.WriteLine("out of colors");
            }
        }
    }
Beispiel #8
0
 private static Texture2D Texture4Color(MeepleColor color)
 {
     return(TextureResources.Get("Player" + color.ToString()));
 }