void Start() { card = GetComponent<Card>(); UIanim = canvas.GetComponent<Animator> (); nowTurn = gameTurn.START_TURN; //メダルの初期値を代入 cpuHavsMedalCount = startMedalCount; playerHavsMedalCount = startMedalCount; //プレイヤーをインスタンス化 Instantiate (Player, transform.position, Quaternion.identity); //totalPlayerCount-1 の数だけEnemyをインスタンス化 for(int i = 0;i<totalPlayerCount - 1;i++){ Instantiate (Enemyp, new Vector3(-2,5.2f,0), Quaternion.identity); } //エネミースクリプトを取得 enemy = FindObjectOfType<Enemy>(); players = FindObjectOfType<Player> (); //テキストを変更する playerHaveMedaltext.text = "残りメダル:" + playerHavsMedalCount; cpuHaveMedaltext.text = "残りメダル:" + cpuHavsMedalCount; cpuNowBettext.text = "CPU Bet:" + cpuNowBets; playerNowBettext.text = "Player Bet:" + playeyNowBets; //cpuCommenttext.text = "よろしくね"; pokarHandsAndHelptext.text = "スタートボタンを押してください。"; }
/// <summary> /// スタートボタン /// </summary> public void startButton() { if(playerHavsMedalCount <= 0 ||cpuHavsMedalCount <= 0){ exitbtn.SetActive (true); if(playerHavsMedalCount<=0){ pokarHandsAndHelptext.text = "メダルがありません、あなたの負けです"; } if(cpuHavsMedalCount <=0){ pokarHandsAndHelptext.text = "メダルがありません、あなたの勝ちです"; } }else{ if(nowTurn == gameTurn.START_TURN){ cpucoment = "良いカードがきますように・・・"; enemy.ChengeFaceSprite (1); helpandhandstext = "場代として1メダルをBETします"; playerHavsMedalCount -= 1; cpuHavsMedalCount -= 1; playeyNowBets += 1; cpuNowBets += 1; TextUpdate (); nowTurn = gameTurn.CARD_DRAW_TIME; UI_Animation (); card.DrawCard(5); } } }
/// <summary> /// 勝負結果に対してのメダル数の変更処理. /// </summary> /// <param name="winner">Winner.</param> public void WinLose(string winner,int pokarHandsScore) { if(winner == "ENEMY"){ Debug.Log (winner); //アタック値の計算>CPUの所持カードの得点を取得しベットで乗算する int Attackint = 0; foreach (int score in enemy.EnemyCardScore) { Attackint += score; } int damage = Attackint * cpuNowBets + pokarHandsScore; pScore.text = "-"+damage; playerHavsMedalCount -= damage; cpuNowBets = 0; playeyNowBets = 0; helpandhandstext = "YOU LOSE "+damage+" 失いました"; cpucoment = "あらあら、勝っちゃったわ。"; enemy.ChengeFaceSprite (13); TextUpdate (); }else if(winner == "PLAYER"){ //アタック値の計算>PLAYERの所持カードの得点を取得しベットで乗算する int Attackint = 0; foreach(int score in players.handCardScore){ Attackint += score; } int damage = Attackint * playeyNowBets + pokarHandsScore; cScore.text = "-"+damage; cpuHavsMedalCount -= damage; cpuNowBets = 0; playeyNowBets = 0; helpandhandstext = "YOU WIN "+damage+" 減らしました"; cpucoment = "た、たまたまよ!次は勝つわ。"; enemy.ChengeFaceSprite (7); TextUpdate (); }else if(winner == "DRAW"){ int pscore = 0; int cpuscore = 0; //アタック値の計算>PLAYERとCPUのアタック値で大きい方から小さい方を引く foreach(int score in players.handCardScore){ pscore += score; } foreach (int score in enemy.EnemyCardScore) { cpuscore += score; } if(pscore > cpuscore){ int damage = pscore - cpuscore; cpuHavsMedalCount -= damage; cpuNowBets = 0; playeyNowBets = 0; cScore.text = "-"+damage; helpandhandstext = "DRAW-WIN "+damage+" 減らしました"; cpucoment = "た、たまたまよ!"; enemy.ChengeFaceSprite (7); }else if(pscore < cpuscore){ int damage = cpuscore - pscore; playerHavsMedalCount -= damage; cpuNowBets = 0; playeyNowBets = 0; pScore.text = "-"+damage; helpandhandstext = "DRAW-LOSE "+damage+" 失いました"; cpucoment = "あらあら、勝っちゃったわ。"; enemy.ChengeFaceSprite (13); }else{ cpuHavsMedalCount += 1; playerHavsMedalCount += 1; cpuNowBets = 0; playeyNowBets = 0; helpandhandstext = "ドローです、場代は返還されます。"; cpucoment = "なかなかやるじゃない・・・"; enemy.ChengeFaceSprite (6); } TextUpdate (); } //親の変更 if(whoisparenet == true){ whoisparenet = false; }else{ whoisparenet = true; } nowTurn = gameTurn.JUDGE_TURN; UI_Animation (); }
/// <summary> /// ドロップボタンの処理. /// </summary> public void dropButton() { //レイズボタンの処理 playeyNowBets = 0; cpuHavsMedalCount += cpuNowBets; cpuNowBets = 0; helpandhandstext = "勝負をおりました。"; cpucoment = "良い判断ね。"; enemy.ChengeFaceSprite (13); TextUpdate (); //card.InitGame (); nowTurn = gameTurn.DROP_TURN; UI_Animation (); }
/// <summary> /// レイズボタンの処理. /// </summary> public void raiseButton() { //レイズボタンの処理 playerHavsMedalCount += playeyNowBets; playeyNowBets = cpuNowBets + 1; playerHavsMedalCount -= playeyNowBets; TextUpdate (); //cpuはこーるするか? if(enemy.DoCall() == true){ cpuHavsMedalCount += cpuNowBets; cpuNowBets = playeyNowBets; cpuHavsMedalCount -= cpuNowBets; cpucoment ="レイズ!?\n乗るわその勝負。"; enemy.ChengeFaceSprite (13); helpandhandstext = "残したいカードをタッチしてください。"; TextUpdate (); nowTurn = gameTurn.CHENGE_TURN; UI_Animation (); }else{ playerHavsMedalCount += playeyNowBets; playeyNowBets = 0; cpuNowBets = 0; cpucoment ="レイズ!?\n降りるわ"; enemy.ChengeFaceSprite (7); helpandhandstext = "相手が降りました。"; TextUpdate (); card.InitGame (); nowTurn = gameTurn.DROP_TURN; UI_Animation (); } }
/// <summary> /// スタートターンにチェンジする /// </summary> public void Chenge_Start_Turn() { nowTurn = gameTurn.START_TURN; UI_Animation (); }
/// <summary> /// コンティニューボタン /// </summary> public void continewButton() { //コンティニューボタン //プッシュ時にリスト及び全状態を初期化させる card.InitGame (); nowTurn = gameTurn.START_TURN; UI_Animation (); cpucoment = "続けるのね、\nよろしく。"; enemy.ChengeFaceSprite (10); pScore.text = ""; cScore.text = ""; TextUpdate (); }
/// <summary> /// プレイヤーターンにチェンジする /// </summary> public void Chenge_player_Turn() { if(whoisparenet == true){ cpucoment = "あなたの親番ね、\nどうするの?"; pokarHandsAndHelptext.text = "あなたの親番ですベットを決めてください"; nowTurn = gameTurn.PLAYER_TURN; UI_Animation (); }else{ int bt = enemy.CPUParentBet (); Debug.Log (bt); cpuHavsMedalCount += cpuNowBets; cpuNowBets += bt; cpuHavsMedalCount -= cpuNowBets; cpucoment = "まあまあね♪"; enemy.ChengeFaceSprite (9); helpandhandstext = "CPUのベットが決まりました。どうしますか?"; TextUpdate (); nowTurn = gameTurn.RAISE_CALL_TURN; UI_Animation (); } }
/// <summary> /// ジャッジターンにチェンジする /// </summary> public void Chenge_Judge_Turn() { nowTurn = gameTurn.JUDGE_TURN; UI_Animation (); }
/// <summary> /// ドローターンにチェンジする. /// </summary> public void Chenge_Draw_Turn() { nowTurn = gameTurn.CARD_DRAW_TIME; UI_Animation (); }
/// <summary> /// コールボタンの処理. /// </summary> public void callButton() { //こーるボタンの処理 if(whoisparenet == true){ //totalPlayerCount += playeyNowBets; playerHavsMedalCount += playeyNowBets; playeyNowBets = cpuNowBets; playerHavsMedalCount -= playeyNowBets; cpucoment ="へぇ、\nいいじゃない。"; enemy.ChengeFaceSprite (12); helpandhandstext = "残したいカードをタッチしてください。"; TextUpdate (); nowTurn = gameTurn.CHENGE_TURN; UI_Animation (); }else{ playerHavsMedalCount += playeyNowBets; playeyNowBets = cpuNowBets; playerHavsMedalCount -= playeyNowBets; cpucoment ="へぇ、乗ってくるの?\nいいのかしら?"; enemy.ChengeFaceSprite (4); helpandhandstext = "残したいカードをタッチしてください。"; TextUpdate (); nowTurn = gameTurn.CHENGE_TURN; UI_Animation (); } }
/// <summary> /// ベットの決定ボタン. /// </summary> public void betDesideButton() { if(playeyNowBets>1){ switch(enemy.thinkBet(playerHavsMedalCount,cpuHavsMedalCount)){ case 0: //ドロップ playerHavsMedalCount += playeyNowBets; playeyNowBets = 0; cpuNowBets = 0; cpucoment = "これはダメね、\n降りるわ"; enemy.ChengeFaceSprite (8); helpandhandstext = "相手が降りました。"; TextUpdate (); nowTurn = gameTurn.DROP_TURN; UI_Animation (); break; case 1: //コール cpuHavsMedalCount += cpuNowBets; cpuNowBets = playeyNowBets; cpuHavsMedalCount -= cpuNowBets; cpucoment = "コールよ。"; enemy.ChengeFaceSprite (12); helpandhandstext = "コールされました。カードを交換してください"; TextUpdate (); nowTurn = gameTurn.CHENGE_TURN; UI_Animation (); break; case 2: //レイズ continuecall = true; cpuHavsMedalCount += cpuNowBets; cpuNowBets = playeyNowBets + 1; cpuHavsMedalCount -= cpuNowBets; cpucoment = "レイズよ。\nさぁ、どうするの?"; enemy.ChengeFaceSprite (4); helpandhandstext = "相手がレイズしました、どうしますか?"; TextUpdate (); nowTurn = gameTurn.RAISE_CALL_TURN; UI_Animation (); break; default: Debug.Log ("BetError"); break; } }else{ //ヘルプのテキストで別途させるテキストを表示 helpandhandstext = "ベットしてください!!"; TextUpdate (); } }