public void Init(int length, PrefabsConfig pConfig) { resultUI.gameObject.SetActive(false); panels.Init(length, pConfig); GamePlayMode gpm = GameManager.Instance.gamePlayMode; switch (gpm.gameMode) { case GameMode.VSAI: player1TurnImage.sprite = roundSpritePVE.player1Turn; player2TurnImage.sprite = roundSpritePVE.player2Turn; break; default: player1TurnImage.sprite = roundSpritePVP.player1Turn; player2TurnImage.sprite = roundSpritePVP.player2Turn; break; } SetRound(0); if (!gpm.doUseSkill) { sBtn.gameObject.SetActive(false); } OnGameStart(); }
public bool CheckWin() { if (CheckDoesGetSevn()) { return(true); } GamePlayMode gpm = GameManager.Instance.gamePlayMode; int controllNum = 0; int takeNum = 0; foreach (int s in record.secord) { if (s > 0) { takeNum++; } if (s > gpm.boardSideLength / 2) { controllNum++; } } if (controllNum > gpm.boardSideLength / 2 && takeNum >= gpm.boardSideLength) { return(true); } return(false); }
public GamePlayPage(GamePlayMode gamePlayMode) { InitializeComponent(); _screenViewModel = new GamePlayScreenViewModel(Container, gamePlayMode); this.BindingContext = _screenViewModel; _screenViewModel.OnUserAlert += (title, message) => { DisplayAlert(title, message, "OK"); }; }
private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(instance); }
private bool CheckDoesGetSevn() { GamePlayMode gpm = GameManager.Instance.gamePlayMode; foreach (int s in record.secord) { if (s >= gpm.boardSideLength) { return(true); } } return(false); }
void SetDefaults() { mMaxCards = 52; mTotalCardTypes = Enum.GetValues(typeof(CardType)).Length; mMaxCardsPerSet = mMaxCards / mTotalCardTypes; mPlayersPlayedThereTurns = 0; mCurrentGamePlayMode = GamePlayMode.TwoPlayer; mListOfCards = new List <Card>(); mListOfPlayers.Clear(); mListPoolOfCards.Clear(); GenerateCards(); }
//true是玩家赢 false是AI赢 private bool CheckWinner(ref AIHardDataStruct curDepthData) { GamePlayMode gpm = GameManager.Instance.gamePlayMode; //先判断是否获得一种颜色的全部棋子 foreach (int s in curDepthData.playerRecord.secord) { if (s >= gpm.boardSideLength) { return(true); } } foreach (int s in curDepthData.aiRecord.secord) { if (s >= gpm.boardSideLength) { return(false); } } int playerControledNum = 0; foreach (var v in curDepthData.playerRecord.secord) { if (v > gpm.boardSideLength / 2) { ++playerControledNum; } } int aiControledNum = 0; foreach (var v in curDepthData.aiRecord.secord) { if (v > gpm.boardSideLength / 2) { ++aiControledNum; } } //再判断谁的分数更高 if (playerControledNum > aiControledNum) { return(true); } else { return(false); } }
public int GetControledColorNum() { int controledNum = 0; foreach (var v in record.secord) { GamePlayMode gpm = GameManager.Instance.gamePlayMode; if (v > gpm.boardSideLength / 2) { ++controledNum; } } return(controledNum); }
public void Init(GamePlayMode arg_gpm) { gpm = arg_gpm; selectedColor = PieceColor.NULL; boardLength = gpm.boardSideLength; nextPieces = new List <Piece>(); pieceRemainNum = gpm.boardSideLength * gpm.boardSideLength; if (gpm.gameMode == GameMode.VSAI && gpm.levelID == 0) { InitNewbie(); } else { isReady = false; StartCoroutine(InitCoroutine()); } }
void OnEnable() { if (!instance) { instance = this; } if (!screenUIController) { screenUIController = FindObjectOfType <ScreenUIController>(); } if (!objectPoolManager) { objectPoolManager = FindObjectOfType <ObjectPoolManager>(); } gamePlayMode = FindObjectOfType <GameController>() == null ? GamePlayMode.Normal : GamePlayMode.AR; }
private bool EngTurn(ref AIHardDataStruct curDepthData) { List <Piece> nextPieces = curDepthData.nextPieces; Piece[,] pieces = curDepthData.pieces; GamePlayMode gpm = GameManager.Instance.gamePlayMode; bool isChanged = true; while (isChanged) { isChanged = false; if (gpm.doUseCrack) { List <Piece> crackPieces = new List <Piece>(); foreach (var p in nextPieces) { if (p.isValid && p.isCrackPiece) { crackPieces.Add(p); isChanged = true; } } if (isChanged) { foreach (var p in crackPieces) { SelectPiece(ref curDepthData, p.x, p.y); if (CheckEndGame(ref curDepthData)) { return(true); } } } } } return(false); }
private bool CheckEndGame(ref AIHardDataStruct curDepthData) { List <Piece> curNextPieces = curDepthData.nextPieces; PlayerRecord curPlayerRecord = curDepthData.playerRecord; PlayerRecord curAiRecord = curDepthData.aiRecord; GamePlayMode gpm = GameManager.Instance.gamePlayMode; if (curNextPieces.Count <= 0) { return(true); } foreach (int s in curPlayerRecord.secord) { if (s >= gpm.boardSideLength) { return(true); } } foreach (int s in curAiRecord.secord) { if (s >= gpm.boardSideLength) { return(true); } } int controllNum = 0; int takeNum = 0; foreach (int s in curAiRecord.secord) { if (s > 0) { takeNum++; } if (s > gpm.boardSideLength / 2) { controllNum++; } } if (controllNum > gpm.boardSideLength / 2 && takeNum >= gpm.boardSideLength) { return(true); } controllNum = 0; takeNum = 0; foreach (int s in curPlayerRecord.secord) { if (s > 0) { takeNum++; } if (s > gpm.boardSideLength / 2) { controllNum++; } } if (controllNum > gpm.boardSideLength / 2 && takeNum >= gpm.boardSideLength) { return(true); } return(false); }
public void OnJoinServer(ServerPlayInfo serverplayinfo) { playMode = GamePlayMode.PlaysOnServer; currentServerPlayInfo = serverplayinfo; }
public void OnPlayLocal() { playMode = GamePlayMode.PlaysLocal; currentServerPlayInfo = new ServerPlayInfo("Local", "", 0, 0, new byte[0]); }
private int CalculateCurValue(ref AIHardDataStruct curDepthData) { GamePlayMode gpm = GameManager.Instance.gamePlayMode; int playerValue = 0; int aiValue = 0; for (int i = 0; i < curDepthData.playerRecord.secord.GetLength(0); ++i) { var v = curDepthData.playerRecord.secord[i]; if (curDepthData.aiRecord.secord[i] > gpm.boardSideLength / 2) { playerValue += v > 0 ? 20 : 0; } else if (v > gpm.boardSideLength / 2) { playerValue += 1000; if (curDepthData.aiRecord.secord[i] > 0) { playerValue += (10 + 4 * 10) * 4 / 2; } else { playerValue += (10 + v * 10) * v / 2; } } else { playerValue += (10 + v * 10) * v / 2; } } for (int i = 0; i < curDepthData.aiRecord.secord.GetLength(0); ++i) { var v = curDepthData.aiRecord.secord[i]; if (curDepthData.playerRecord.secord[i] > gpm.boardSideLength / 2) { aiValue += v > 0 ? 20 : 0; } else if (v > gpm.boardSideLength / 2) { aiValue += 1000; if (curDepthData.playerRecord.secord[i] > 0) { aiValue += (10 + 4 * 10) * 4 / 2; } else { aiValue += (10 + v * 10) * v / 2; } } else { aiValue += (10 + v * 10) * v / 2; } } int value = aiValue - playerValue; if (curDepthData.depth % 2 == 0) { return(value); } else { return(value); } }
public void GoToStoryMode() { this.gamePlayMode = GamePlayMode.Story; scenesManager.ChangeScene("Gameplay"); }
public void GoToSurviveMode() { this.bannerViewManager.HideBanner(); this.gamePlayMode = GamePlayMode.Survive; scenesManager.ChangeScene("Gameplay"); }
public void GoToHome() { this.bannerViewManager.ShowBanner(); this.gamePlayMode = GamePlayMode.None; scenesManager.ChangeScene("main"); }