public void TestChangeMeepleNegativeStartField() { GameTable gameTable = _hub.GetGeneratedGameTable(TableId); PlayerFieldArea greenArea = gameTable.PlayerFieldAreas.Find(area => area.ColorCode == ColorCode.Green); PlayerFieldArea blueArea = gameTable.PlayerFieldAreas.Find(area => area.ColorCode == ColorCode.Blue); StandardField startField = greenArea.Fields[10] as StandardField; StartField endField = greenArea.Fields.Find(field => field.FieldType.Contains("StartField")) as StartField; Meeple meeple1 = greenArea.Meeples[0]; Meeple meeple2 = blueArea.Meeples[0]; meeple2.IsStartFieldBlocked = true; startField.CurrentMeeple = meeple1; endField.CurrentMeeple = meeple2; MeepleMove meepleMove = new MeepleMove() { Meeple = meeple1, MoveDestination = endField }; CardMove cardMove = new CardMove() { Card = _cardChange, SelectedAttribute = CardAttributeChangePlace }; Assert.AreEqual(false, Validation.ValidateMove(meepleMove, cardMove)); }
public MeepleSelectionButton Init(Meeple meeple) { this.meeple = meeple; GetComponentInChildren <Text>().text = meeple.Label; return(this); }
/// <summary>Elhelyezi a kapott figurát a konstrukción.</summary> /// <param name="meeple">Elhelyezendő figura.</param> public void AddMeeple(Meeple meeple) { if (!IsFinished && meeples.Count == 0) meeples.Add(meeple); else throw new InvalidOperationException(); }
public static bool ProveChangePlace(Meeple moveMeeple, MoveDestinationField destinationField) { if (moveMeeple == null || destinationField.CurrentMeeple == null) { return(false); } if (IsSameColorCode(moveMeeple.ColorCode, destinationField.CurrentMeeple.ColorCode)) { return(false); } if (IsSimpleInvalidChangeField(destinationField) || IsSimpleInvalidChangeField(moveMeeple.CurrentPosition)) { return(false); } if (IsStandardField(destinationField) && !IsStandardField(moveMeeple.CurrentPosition)) { return(IsValidStartField(moveMeeple.CurrentPosition)); } if (!IsStandardField(destinationField) && IsStandardField(moveMeeple.CurrentPosition)) { return(IsValidStartField(destinationField)); } if (!(IsStandardField(moveMeeple.CurrentPosition) && IsStandardField(destinationField))) { return(IsValidStartField(destinationField) && IsValidStartField(moveMeeple.CurrentPosition)); } return(true); }
public static void positionAndParent_Meeple(GameObject Meeple, HexaPos position) { GameObject par = GameObject.Find("MeepleCollection"); GameObject fath = new GameObject(Meeple.GetComponent <Meeple>().meepleName); fath.transform.localScale = par.transform.lossyScale; fath.transform.position = par.transform.position; Meeple.transform.localScale = par.transform.lossyScale; Meeple.transform.position = par.transform.position; Meeple.transform.localEulerAngles = new Vector3(0, 180, 0); //Meeple.transform.Translate(new Vector3(0, 0.4f, 0), Space.Self); fath.transform.parent = par.transform; Meeple.transform.parent = fath.transform; setMeeplePos(Meeple, position); Meeple mip = Meeple.GetComponent <Meeple>(); if (mip.GetType().IsSubclassOf(typeof(Companion))) { Companion c = Meeple.GetComponent <Companion>(); if (c.GetType().Name != "PackAnimal") { c.setFoodPackages_hpBar(); } } }
public override void AddMeeple(Meeple meeple, SubArea subArea) { if (meeples.Count > 0) throw new InvalidOperationException(); meeples.Add(meeple); }
public void DeselectMeeple() { if (selectedMeeple) { selectedMeeple.OnHoverLeave(); selectedMeeple = null; }; ViewNodeDetails(selectedNode); }
public void TestChangeMeeplePositive() { GameTable gameTable = _hub.GetGeneratedGameTable(TableId); PlayerFieldArea greenArea = gameTable.PlayerFieldAreas.Find(area => area.ColorCode == ColorCode.Green); PlayerFieldArea blueArea = gameTable.PlayerFieldAreas.Find(area => area.ColorCode == ColorCode.Blue); StandardField startField = greenArea.Fields[10] as StandardField; StandardField endField = greenArea.Fields[14] as StandardField; Meeple meeple1 = greenArea.Meeples[0]; Meeple meeple2 = blueArea.Meeples[0]; startField.CurrentMeeple = meeple1; endField.CurrentMeeple = meeple2; MeepleMove meepleMove = new MeepleMove() { Meeple = meeple1, MoveDestination = endField }; CardMove cardMove = new CardMove() { Card = _cardJoker, SelectedAttribute = CardAttributeChangePlace }; Assert.AreEqual(true, Validation.ValidateMove(meepleMove, cardMove)); }
public void Activate(Meeple meeple) { if (!isActive) { Initiate(meeple); } }
public void AddMeeple(Meeple meeple) { meeples.Add(meeple); Transform slot = GetSlot(); meeple.transform.parent = slot; meeple.transform.localPosition = Vector3.zero; }
protected override void CreateMeeples() { for (int i = 0; i < 2; i++) { Meeple newMeep = new Meeple(this, new Rectangle(0, 0, Board.Instance().boardUnit, Board.Instance().boardUnit), UID + "_meeple" + i, meepidx: i); newMeep.Create(); } }
public Meeple AddMeeple(Location location) { GameObject meepleObj = Object.Instantiate(meeplePrefab, transform); Meeple meeple = meepleObj.GetComponent <Meeple>(); location.AddMeeple(meeple); return(meeple); }
public void TestProveLeaveKennelEmptyDestinationField() { Meeple meeple = new Meeple(new KennelField(1), ColorCode.Blue); Meeple meeple2 = new Meeple(new KennelField(2), ColorCode.Green); meeple.CurrentPosition = new KennelField(2); StartField field2 = new StartField(3, ColorCode.Blue); Assert.AreEqual(true, Validation.ProveLeaveKennel(meeple, field2)); }
public bool ProveLeaveKennel(List <Meeple> myMeeples) { if (myMeeples == null) { return(false); } List <Meeple> proveMeeples = myMeeples.FindAll(meeple => meeple.CurrentPosition.FieldType.Contains("KennelField")); Meeple proveStartMeeple = myMeeples.Find(startMeeple => startMeeple.CurrentPosition.FieldType.Contains("StartField") && !Validation.IsValidStartField(startMeeple.CurrentPosition)); return(proveMeeples.Count > 0 && proveStartMeeple == null); }
public void TestCanMoveToEndFieldsBug340() { GameTable table = MakeInitialGameTable; Meeple meeple = new Meeple(new KennelField(77), ColorCode.Yellow) { IsStartFieldBlocked = false }; StandardField standardField = (StandardField)table.PlayerFieldAreas.Find(area => area.ColorCode == ColorCode.Yellow).Fields[0]; standardField.CurrentMeeple = meeple; Assert.AreEqual(true, Validation.CanMoveToEndFields(standardField, 5, meeple.ColorCode)); }
public void TestProveLeaveKennelNotSameColor() { Meeple meeple = new Meeple(new KennelField(1), ColorCode.Red); Meeple meeple2 = new Meeple(new KennelField(2), ColorCode.Green); meeple.CurrentPosition = new KennelField(2); StartField field2 = new StartField(3, ColorCode.Blue) { CurrentMeeple = meeple2 }; Assert.AreEqual(false, Validation.ProveLeaveKennel(meeple, field2)); }
public void TestProveChangePlaceEndFieldSameColorMeeple() { Meeple meeple = new Meeple(new KennelField(1), ColorCode.Blue); Meeple meeple2 = new Meeple(new KennelField(2), ColorCode.Blue); meeple.CurrentPosition = new EndField(2); EndField field2 = new EndField(3) { CurrentMeeple = meeple2 }; Assert.AreEqual(false, Validation.ProveChangePlace(meeple, field2)); }
public void TestProveChangePlaceStandardField() { Meeple meeple = new Meeple(new KennelField(1), ColorCode.Blue); Meeple meeple2 = new Meeple(new KennelField(2), ColorCode.Green); meeple.CurrentPosition = new StandardField(2); StandardField field2 = new StandardField(3) { CurrentMeeple = meeple2 }; Assert.AreEqual(true, Validation.ProveChangePlace(meeple, field2)); }
public void TestHasBlockedFieldBackwardsFromStart() { GameTable table = MakeInitialGameTable; //Meeple meeple = new Meeple(new KennelField(1), ColorCode.Blue); Meeple meeple2 = new Meeple(new KennelField(2), ColorCode.Blue) { IsStartFieldBlocked = true }; StartField startField = (StartField)table.PlayerFieldAreas.Find(area => area.ColorCode == ColorCode.Blue).Fields.Find(field => field.FieldType.Contains("StartField")); startField.CurrentMeeple = meeple2; Assert.AreEqual(false, Validation.HasBlockedField(startField, -4)); }
public void TestUpdateMeeplePositionNoMeepleMove() { GameTable table = MakeInitialGameTable; PlayerFieldArea redArea = table.PlayerFieldAreas.Find(area => area.ColorCode == ColorCode.Red); Meeple redMeeple = redArea.Meeples.First(); MoveDestinationField currentField = redArea.Fields.Find(field => field.FieldType.Contains("StartField")); currentField.CurrentMeeple = redMeeple; MoveDestinationField moveField = redArea.Fields.Find(field => field.FieldType.Contains("StandardField")); GameTable notModified = table; GameTableService.UpdateMeeplePosition(null, table, false); Assert.AreEqual(table, notModified); }
public void TestGetOpenMeeples() { GameTable actualGameTable = MakeInitialGameTable; List <Meeple> myMeeples = actualGameTable.PlayerFieldAreas.Find(area => area.ColorCode == ColorCode.Blue).Meeples; Meeple meeple = myMeeples.First(); meeple.IsStartFieldBlocked = false; meeple.CurrentPosition = actualGameTable.PlayerFieldAreas.Find(area => area.ColorCode == ColorCode.Blue).Fields[7]; List <Meeple> openMeeples = GameTableService.GetOpenMeeples(myMeeples); Assert.AreEqual(1, openMeeples.Count); }
/** * places meeple in current structure, then triggers meeple own placement */ public void PlaceMeeple(Tile tile, Meeple meeple) { if (!this.ComponentTiles.Contains(tile)) { throw new Exception("Tile not in Component tiles"); } if (this.MeepleList.Count != 0) { //throw new Exception("Meeple is not alone in structure"); return; } this.MeepleList.Add(meeple); meeple.PlaceMeeple(tile, this.StructureId); }
private static Meeple SetBackToKennelField(GameTable actualGameTable, Meeple moveDestinationMeeple) { if (moveDestinationMeeple == null) { return(null); } foreach (KennelField kennelField in actualGameTable.PlayerFieldAreas.Select(area => area.KennelFields.Find( field => field.CurrentMeeple == null && area.ColorCode == moveDestinationMeeple.ColorCode)).Where(kennelField => kennelField != null)) { moveDestinationMeeple.CurrentFieldId = kennelField.Identifier; moveDestinationMeeple.CurrentPosition = kennelField; kennelField.CurrentMeeple = moveDestinationMeeple; } return(moveDestinationMeeple); }
public void TestUpdateMeeplePositionCorrectlyInitialized() { GameTable table = MakeInitialGameTable; PlayerFieldArea redArea = table.PlayerFieldAreas.Find(area => area.ColorCode == ColorCode.Red); Meeple redMeeple = redArea.Meeples.First(); MoveDestinationField currentField = redArea.Fields.Find(field => field.FieldType.Contains("StartField")); currentField.CurrentMeeple = redMeeple; MoveDestinationField moveField = redArea.Fields.Find(field => field.FieldType.Contains("StandardField")); GameTableService.UpdateMeeplePosition(new MeepleMove() { Meeple = redMeeple, MoveDestination = moveField }, table, false); Assert.AreEqual(moveField, table.PlayerFieldAreas.Find(area => area.ColorCode == ColorCode.Red).Fields.Find(field => field.CurrentMeeple == redMeeple)); }
public override int GetHashCode() { var result = 0; if (null != Player) { result += Player.GetHashCode(); } if (null != Meeple) { result += Meeple.GetHashCode(); } result += RequestType.GetHashCode(); result += Options.Sum(o => o.GetHashCode()); return(result); }
public void TestProveLeaveKennelBlockedStartField() { Meeple meeple = new Meeple(new KennelField(1), ColorCode.Red); Meeple meeple2 = new Meeple(new KennelField(2), ColorCode.Green) { IsStartFieldBlocked = true }; meeple.CurrentPosition = new KennelField(2); StartField field2 = new StartField(3, ColorCode.Red) { CurrentMeeple = meeple2 }; Assert.AreEqual(false, Validation.ProveLeaveKennel(meeple, field2)); }
public void TestProveValueCardStandardFieldOverStartNotBlocked() { GameTable table = MakeInitialGameTable; Meeple meeple = new Meeple(new KennelField(1), ColorCode.Blue); Meeple meeple2 = new Meeple(new KennelField(2), ColorCode.Blue) { IsStartFieldBlocked = false }; StartField startField = (StartField)table.PlayerFieldAreas.Find(area => area.ColorCode == ColorCode.Blue).Fields.Find(field => field.FieldType.Contains("StartField")); startField.CurrentMeeple = meeple2; StandardField standardField = (StandardField)table.PlayerFieldAreas.Find(area => area.ColorCode == ColorCode.Blue).Fields.Find(field => field.FieldType.Contains("StandardField")); standardField.CurrentMeeple = meeple; Assert.AreEqual(true, Validation.ProveValueCard(meeple, (StartField)table.PlayerFieldAreas.Find(area => area.ColorCode == ColorCode.Blue).Fields[4], 4)); }
public void TestCanNotMoveToEndFields() { GameTable table = MakeInitialGameTable; Meeple meeple = new Meeple(new KennelField(1), ColorCode.Blue); Meeple meeple2 = new Meeple(new KennelField(2), ColorCode.Blue) { IsStartFieldBlocked = true }; StartField startField = (StartField)table.PlayerFieldAreas.Find(area => area.ColorCode == ColorCode.Blue).Fields.Find(field => field.FieldType.Contains("StartField")); startField.CurrentMeeple = meeple2; StandardField standardField = (StandardField)table.PlayerFieldAreas.Find(area => area.ColorCode == ColorCode.Blue).Fields[7]; standardField.CurrentMeeple = meeple; Assert.AreEqual(false, Validation.CanMoveToEndFields(standardField, 8, meeple.ColorCode)); }
public static bool ProveLeaveKennel(Meeple moveMeeple, MoveDestinationField destinationField) { if (!moveMeeple.CurrentPosition.FieldType.Contains("KennelField")) { return(false); } if (!destinationField.FieldType.Contains("StartField")) { return(false); } StartField startField = destinationField as StartField; if (startField != null && !IsSameColorCode(startField.ColorCode, moveMeeple.ColorCode)) { return(false); } return(destinationField.CurrentMeeple == null || IsValidStartField(destinationField)); }
private void Initiate(Meeple meeple) { this.meeple = meeple; this.start = meeple.standingOn; startCenter = start.Position.Center.ToVector2(); curArrow = new ArrowAnimatable(start.Position, "movementarrow", start.ZPosition + 1); CommandQueue.Queue(new AddToBoardCommand(curArrow)); // build direction vectors to each connected field directions = new Vector2[start.connectedFields.Count]; for (int i = 0; i < directions.Length; i++) { directions[i] = start.connectedFields[i].Position.Center.ToVector2() - startCenter; directions[i].Normalize(); } isActive = true; initiated = DateTime.Now; }
public static bool ProveValueCard(Meeple moveMeeple, MoveDestinationField destinationField, int value) { MoveDestinationField currentPos = moveMeeple.CurrentPosition; if (destinationField == null) { return(false); } if (HasBlockedField(currentPos, value)) { return(false); } if (destinationField.FieldType.Contains("EndField")) { return(CanMoveToEndFields(currentPos, value, moveMeeple.ColorCode)); } currentPos = GetNextField(currentPos, value); return(currentPos?.Identifier == destinationField.Identifier); }
public void TestProveChangePlaceStartfFieldNotBlocked() { Meeple meeple = new Meeple(new KennelField(1), ColorCode.Green) { IsStartFieldBlocked = false }; Meeple meeple2 = new Meeple(new KennelField(2), ColorCode.Blue) { IsStartFieldBlocked = false }; meeple.CurrentPosition = new StartField(1, ColorCode.Blue); StartField field2 = new StartField(2, ColorCode.Green) { CurrentMeeple = meeple2 }; Assert.AreEqual(true, Validation.ProveChangePlace(meeple, field2)); }
public virtual void AddMeeple(Meeple meeple, SubArea subArea) { }