Example #1
0
 public bool Set(string playerId, Wabe wabe, WabeField field, out string error)
 {
     if (wabe.X > GameMap.Wabes.GetLength(0) || wabe.X < 0)
     {
         throw new IndexOutOfRangeException("x");
     }
     if (wabe.Y > GameMap.Wabes.GetLength(1) || wabe.Y < 0)
     {
         throw new IndexOutOfRangeException("y");
     }
     if (CurrentPlayer.Id != playerId)
     {
         error = "You aren't the current player";
         return(false);
     }
     if (wabe.Owner != null && wabe.Owner.Id != playerId)
     {
         error = "This wabe is already owned by another player";
         return(false);
     }
     if (!_executedFirstPlace[CurrentPlayer])
     {
         _executedFirstPlace[CurrentPlayer] = true;
     }
     wabe.Set(CurrentPlayer, field);
     error         = null;
     CurrentPlayer = Players.NextOfPlayer(CurrentPlayer, _isOut);
     return(true);
 }
Example #2
0
        public Map(ChainReactGame game, bool skipAnimation, bool output)
        {
            Wabes = new Wabe[6, 6];
            for (var x = 0; x <= 5; x++)
            {
                for (var y = 0; y <= 5; y++)
                {
                    WabeType type;
                    if (x == 0 && y == 0 || x == Wabes.GetLength(0) - 1 && y == 0 ||
                        x == 0 && y == Wabes.GetLength(1) - 1 ||
                        x == Wabes.GetLength(0) - 1 && y == Wabes.GetLength(1) - 1)
                    {
                        type = WabeType.TwoWabe;
                    }
                    else if (x == 0 || y == 0 || x == Wabes.GetLength(0) - 1 || y == Wabes.GetLength(1) - 1)
                    {
                        type = WabeType.ThreeWabe;
                    }
                    else
                    {
                        type = WabeType.FourWabe;
                    }

                    Wabes[x, y] = new Wabe(game, type, x, y, ChainReactGame.WabeSize, skipAnimation);
                }
            }
        }
Example #3
0
 public WabeLayout(Wabe wabe, Vector2 position)
 {
     if (wabe == null)
         throw new ArgumentNullException(nameof(wabe));
     _wabe = wabe;
     Direction = CalculateDirection(position);
     GenerateFieldArray();
 }
Example #4
0
 public WabeLayout(Wabe wabe, WabeDirection direction)
 {
     if (wabe == null)
         throw new ArgumentNullException(nameof(wabe));
     _wabe = wabe;
     Direction = direction;
     GenerateFieldArray();
 }
Example #5
0
 public WabeLayout(Wabe wabe, Vector2 position)
 {
     if (wabe == null)
     {
         throw new ArgumentNullException(nameof(wabe));
     }
     _wabe     = wabe;
     Direction = CalculateDirection(position);
     GenerateFieldArray();
 }
Example #6
0
 public WabeLayout(Wabe wabe, WabeDirection direction)
 {
     if (wabe == null)
     {
         throw new ArgumentNullException(nameof(wabe));
     }
     _wabe     = wabe;
     Direction = direction;
     GenerateFieldArray();
 }
Example #7
0
 public WabeField GetField(Wabe wabe, int id)
 {
     return(this[wabe.X, wabe.Y].Fields[id]);
 }