public void OnGameOver(UIStorage storage, int turn, Ruler.GameResult result) { player0Name.text = storage.playerDown.playerName.text; player1Name.text = storage.playerUp.playerName.text; player0Flag.sprite = storage.playerDown.flag.sprite; player0Flag.SetNativeSize(); player1Flag.sprite = storage.playerUp.flag.sprite; player1Flag.SetNativeSize(); turnNum.text = turn.ToString("D2"); bool player0Highlight = (result == Ruler.GameResult.Black_Win && !GameInfo.Instance.ShouldUpsidedown) || (result == Ruler.GameResult.White_Win && GameInfo.Instance.ShouldUpsidedown); bool player1Highlight = (result == Ruler.GameResult.White_Win && !GameInfo.Instance.ShouldUpsidedown) || (result == Ruler.GameResult.Black_Win && GameInfo.Instance.ShouldUpsidedown); player0Name.color = player0Highlight ? StorageInfo.Orange : Color.white; player0Flag.color = player0Highlight ? StorageInfo.Orange : Color.white; player0Result.sprite = player0Highlight ? winSprite : loseSprite; player0Result.SetNativeSize(); player1Name.color = player1Highlight ? StorageInfo.Orange : Color.white; player1Flag.color = player1Highlight ? StorageInfo.Orange : Color.white; player1Result.sprite = player1Highlight ? winSprite : loseSprite; player1Result.SetNativeSize(); infoPanel.localPosition = new Vector3(infoPanel.rect.width, 0, 0); iTween.MoveTo(infoPanel.gameObject, iTween.Hash("position", Vector3.zero, "time", moveInTime, "easetype", iTween.EaseType.easeOutBounce, "islocal", true)); }
public bool CanBuy(Unit.TypeEnum type, Unit.OwnerEnum owner) { if (hasBuy) { return(false); } if (!Unit.IsSoldier(type)) { return(false); } if (playerInfo[(int)owner][(int)Unit.TypeEnum.Bread] < StorageInfo.CardCost[UIStorage.TypeToIndex(type)]) { return(false); } if (GetInfo(BoardInfo.Base[(int)owner]).owner != Unit.OwnerEnum.None) { return(false); } if (type == Unit.TypeEnum.Bomb && GameInfo.Instance.board.GetPlayerInfo(Unit.TypeEnum.Bomb, turn) >= 2) { return(false); } if (type == Unit.TypeEnum.Boss && GetPlayerInfo(Unit.TypeEnum.Boss, turn) != 0) { return(false); } if (GetPlayerTotalCount(turn) - GetPlayerInfo(Unit.TypeEnum.Bread, turn) >= 5) { return(false); } return(true); }
void Start() { board = GameInfo.Instance.board; storage = GameInfo.Instance.storage; if (Agent == null) { Agent = GameObject.FindObjectOfType <PlayerAgent>(); } NewGame(gameMode); StartGame(); }
public bool Buy(Unit.TypeEnum type, Unit.OwnerEnum owner) { if (!CanBuy(type, owner)) { return(false); } Put(BoardInfo.Base[(int)owner], new UnitInfo(type, owner)); playerInfo[(int)owner][(int)Unit.TypeEnum.Bread] -= StorageInfo.CardCost[UIStorage.TypeToIndex(type)]; hasBuy = true; return(true); }
public void SetTraits(Trait[] traits) { this.traits = traits; // if don't have text or trait images if ((traitsText.Length == 0 || traitsText == null) && (traitImages.Length == 0 || traitImages == null)) { return; } // iterate through each trait that this card has for (int i = 0; i < traits.Length; i++) { if (i == 2) { Transform parent = traitImages[2].transform.parent.parent; for (int x = 0; x < parent.childCount; x++) { parent.GetChild(x).gameObject.SetActive(true); } } // set trait text if (traitsText.Length > i) { traitsText[i].text = traits[i].ToString(); } if (traitImages.Length > i) { int indexOfTrait = (int)traits[i]; Sprite traitIcon = UIStorage.GetTraitIcons()[indexOfTrait]; // set trait icon traitImages[i].sprite = traitIcon; } } // disable pictures and text of this ui because we don't want to diplay it if (traits.Length < 3) { Transform parent = traitImages[2].transform.parent.parent; for (int x = 0; x < parent.childCount; x++) { parent.GetChild(x).gameObject.SetActive(false); } } }
void SetFrameColorUI() { cardFrame.color = UIStorage.GetFrameColor(cost - 1); }