/// <summary> /// Returns a new deck. /// </summary> /// <param name="pDeckType">The type of deck we need</param> /// <returns></returns> public Pile Instatiate(PileType pPile, Vector3 pPosition) { var obj = (GameObject)Instantiate(PrefabContainer.Instance.GetPrefab(PrefabContainer.Prefabs.Pile), pPosition, Quaternion.identity); System.Diagnostics.Debug.Assert(obj != null); Pile pile = null; switch (pPile) { case PileType.Random: pile = obj.AddComponent<RandomPile>(); break; case PileType.Stack: pile = obj.AddComponent<StackPile>(); break; } if (pile != null) { pile.transform.parent = PileHolder; return pile; } System.Diagnostics.Debug.Assert(false); return null; }
public Pile(Game game, PileType type, string identifier) : this() { Game = game; Type = type; Identifier = identifier; }
public bool IsValid() { PileType fromPileType = _fromPile.PileType; PileType toPileType = _toPile.PileType; if (_fromPile.Count <= 0) { return(false); } switch (fromPileType) { case PileType.Build: // Can never play from a build pile return(false); case PileType.Discard: // Can only play from discard to build pile if (toPileType != PileType.Build) { return(false); } return(true); case PileType.Hand: // Can only play from hand to build or discard pile if (toPileType != PileType.Build && toPileType != PileType.Discard) { return(false); } return(true); case PileType.Reserve: // Can only play from reserve to build if (toPileType != PileType.Build) { return(false); } if (_fromPileCardIndex < 0) { return(false); } return(true); case PileType.Draw: // Can only "play" (deal) from draw pile to players hand if (_toPile.PileType != PileType.Hand) { return(false); } return(true); default: throw new InvalidPlayException(this); } }
public Pile(Visibility visibility, PileType pileType, Accessability accessibility, float hAlignPercent, float vAlignpercent, Player owner, List <Card> listOfCards, int pileNo) { Visibility = visibility; PileType = pileType; Accessibility = accessibility; HAlignPercent = hAlignPercent; VAlignPercent = vAlignpercent; Owner = owner; Cards = listOfCards ?? new List <Card>(); PileNo = pileNo; }
/// <summary> /// Create a new deck /// </summary> /// <param name="pCardType">The cards type are the cards the deck needs to contain</param> /// <param name="pDeckType">The type of deck we want</param> /// <returns></returns> public static Pile GreatePile(PileType pPile, VisableCardStyle pShowMode, PickStyle pPickMode, Vector3 pPosition) { //Get a new pile. var pile = GetPile(pPile, pPosition); pile.Initialize(pShowMode, pPickMode); //Name the pile pile.name = string.Format("{0}_{1}", pile.GetType().Name, pile.PileId); return pile; }
List <AbstractCard> GetPile(PileType type) { var state = GameState.Instance; if (type == PileType.DISCARD) { return(state.Deck.DiscardPile); } else if (type == PileType.DRAW) { return(state.Deck.DrawPile); } else { return(state.Deck.ExhaustPile); } }
public void CheckIfPileIsCreatedWithTheCorrectParameters() { //Arrange Visibility pileVisibility = Visibility.VisibleToNoOne; PileType pileType = PileType.Deck; Accessability pileAccessability = Accessability.AccessableToAll; float hAlignPercent = 0.5f; float vAlignPercent = 0.6f; Player player = new Player("testName", 1, Color.Red); int pileNo = 0; //Act Pile pile = new Pile(pileVisibility, pileType, pileAccessability, hAlignPercent, vAlignPercent, player, null, pileNo); //Assert Assert.AreEqual(pileVisibility, pile.Visibility); Assert.AreEqual(pileType, pile.PileType); Assert.AreEqual(pileAccessability, pile.Accessibility); Assert.AreEqual(hAlignPercent, pile.HAlignPercent); Assert.AreEqual(vAlignPercent, pile.VAlignPercent); Assert.AreEqual(player, pile.Owner); Assert.IsNotNull(pile.GetCards()); }
public override string Print(bool link = true, DwarfObject pov = null) { string eventString = GetYearTime(); if (Bodies.Count > 1) { eventString += "the bodies of "; for (int i = 0; i < Bodies.Count; i++) { eventString += Bodies[i].ToLink(link, pov, this) ?? "UNKNOWN HISTORICAL FIGURE"; if (i != Bodies.Count - 1) { if (i == Bodies.Count - 2) { eventString += " and "; } else { eventString += ", "; } } } eventString += " were "; } else { eventString += "the body of "; eventString += Bodies.FirstOrDefault()?.ToLink(link, pov, this) ?? "UNKNOWN HISTORICAL FIGURE"; eventString += " was "; } switch (AbuseType) { case AbuseType.Impaled: eventString += "impaled on a "; eventString += !string.IsNullOrWhiteSpace(Material) ? Material + " " : ""; if (!string.IsNullOrWhiteSpace(ItemSubType) && ItemSubType != "-1") { eventString += ItemSubType; } else { eventString += !string.IsNullOrWhiteSpace(ItemType) ? ItemType : "UNKNOWN ITEM"; } break; case AbuseType.Piled: eventString += "added to a " + PileType.GetDescription(); break; case AbuseType.Flayed: eventString += "flayed"; break; case AbuseType.Hung: eventString += "hung"; break; case AbuseType.Mutilated: eventString += "horribly mutilated"; break; case AbuseType.Animated: eventString += "animated"; break; default: eventString += "abused"; break; } eventString += " by "; if (HistoricalFigure != null) { eventString += HistoricalFigure.ToLink(link, pov, this); if (Abuser != null) { eventString += " of "; } } if (Abuser != null) { eventString += Abuser.ToLink(link, pov, this); } if (Structure != null) { eventString += " in "; eventString += Structure.ToLink(link, pov, this); } if (Site != null) { eventString += " in "; eventString += Site.ToLink(link, pov, this); } else if (Region != null) { eventString += " in "; eventString += Region.ToLink(link, pov, this); } else if (UndergroundRegion != null) { eventString += " in "; eventString += UndergroundRegion.ToLink(link, pov, this); } eventString += PrintParentCollection(link, pov); eventString += "."; return(eventString); }
public Pile(PileType pileType) { _pileType = pileType; _pileIndex = _countOfPileTypes[pileType]; _countOfPileTypes[pileType]++; }
public CardPile() { pile_name = "none"; pileType = PileType.none; }
public CardPile(PileType type) { pile_name = type.ToString(); pileType = type; }
/// <summary> /// Get a pile /// </summary> /// <param name="pPile">The type of pile</param> /// <param name="pPosition">The position of the pile</param> /// <returns></returns> private static Pile GetPile(PileType pPile, Vector3 pPosition) { return PileInstatiator.Instance.Instatiate(pPile, pPosition); }