//-------------------------------------------------------------------------------------------- //移動効果中処理--------------------------------------------------------------------------------- void MoveEffect( ) { List <Square> squares = _field.MovePossibleSquare(_card, _card.Card_Data._effect_direction, _nowSquare, _card.Card_Data._effect_distance); _turnPlayer.SquareChangeColor(squares, true); if (_mainSceneOperation.MouseTouch( )) { Square square = _rayShooter.RayCastSquare( ); //マウスをクリックしたらレイを飛ばしてマスを取得する _turnPlayer.SquareChangeColor(squares, false); //色をもとに戻す _uiActiveManager.ButtonActiveChanger(false, UIActiveManager.BUTTON.BACK); if (square != null) { _turnPlayer.UseEffect(_card, _nowSquare, square); //移動できるかどうかを判定し移動できたら移動する } GetDataReset( ); _mainPhaseStatus = MAIN_PHASE_STATUS.IDLE; return; } if (_mainSceneOperation.BackButtonClicked( )) { _turnPlayer.SquareChangeColor(squares, false); _uiActiveManager.ButtonActiveChanger(false, UIActiveManager.BUTTON.BACK); GetDataReset( ); _mainPhaseStatus = MAIN_PHASE_STATUS.IDLE; return; } }
//-------------------------------------------------------------------------- //手札操作状態処理---------------------------------------------------------------------- void HnadOperationStatus( ) { _handCard.transform.position = _mainSceneOperation.getWorldMousePos( ); List <Square> summonableSquares = _field.SummonSquare(_turnPlayer.gameObject.tag); if (_turnPlayer.DecreaseMPointConfirmation(_handCard.Card_Data._necessaryMP)) { _turnPlayer.SquareChangeColor(summonableSquares, true); } //手札を離したとき if (!_mainSceneOperation.MouseConsecutivelyTouch( )) { if (_mainSceneOperation.getHoldCount( ) <= SHOW_DETAILS_HOLD_TIME) //離したのが一定時間内だったら { _handCard.ShowCardDetail( ); _uiActiveManager.ButtonActiveChanger(true, UIActiveManager.BUTTON.BACK); _turnPlayer.SquareChangeColor(summonableSquares, false); HandCardRestore( ); _mainPhaseStatus = MAIN_PHASE_STATUS.HAND_CARD_DETAILS; return; } else { _turnPlayer.SquareChangeColor(summonableSquares, false); _mainPhaseStatus = MAIN_PHASE_STATUS.HANC_CARD_SUMMON; return; } } }
//攻撃効果中処理------------------------------------------------------------------------------ void AttackEffect( ) { List <Square> squares = _field.AttackEffectPossibleOnCardSquare(_card, _nowSquare); _turnPlayer.SquareChangeColor(squares, true); if (_mainSceneOperation.BackButtonClicked( )) { _turnPlayer.SquareChangeColor(squares, false); _uiActiveManager.AllButtonActiveChanger(false); GetDataReset( ); _mainPhaseStatus = MAIN_PHASE_STATUS.IDLE; return; } if (_mainSceneOperation.EffectYesButtonClicked( )) { _turnPlayer.SquareChangeColor(squares, false); _turnPlayer.UseEffect(_card, _nowSquare); _uiActiveManager.AllButtonActiveChanger(false); GetDataReset( ); _mainPhaseStatus = MAIN_PHASE_STATUS.IDLE; return; } }
//-------------------------------------------------------------------------------------------------------------------------- //ダイレクトアタック処理---------------------------------------------------- void DirectAttack( ) { _turnPlayer.DirectAttack(_enemyPlayer, _card.Card_Data._necessaryAP, _card); GetDataReset( ); _mainPhaseStatus = MAIN_PHASE_STATUS.IDLE; return; }
//-------------------------------------------------------------------------------------- //手札の詳細表示状態------------------------------------------------------------------- void HnadCardDetailsStatus( ) { if (_mainSceneOperation.BackButtonClicked( )) { _handCard.DeleteCardDetail( ); _uiActiveManager.ButtonActiveChanger(false, UIActiveManager.BUTTON.BACK); _mainPhaseStatus = MAIN_PHASE_STATUS.IDLE; } }
//--------------------------------------------------------------- //手札のカードがタッチされたら処理------------------------------------------- void HandCardTouch( ) { _handCard = _rayShooter.RayCastHandCard(_turnPlayer.gameObject.tag); if (_handCard == null) { return; } _handCardPos = _handCard.transform.position; _handCard.gameObject.GetComponent <BoxCollider2D>( ).enabled = false; _handCard.CardExpansion( ); _mainPhaseStatus = MAIN_PHASE_STATUS.HAND_CARD_OPERATION; }
//------------------------------------------------------------------------------------- //召喚処理-------------------------------------------------------------------------------- void HandCardSummon( ) { List <Square> summonableSquares = _field.SummonSquare(_turnPlayer.gameObject.tag); //MPが足りなかったら if (!_turnPlayer.DecreaseMPointConfirmation(_handCard.Card_Data._necessaryMP)) { HandCardRestore( ); _mainPhaseStatus = MAIN_PHASE_STATUS.IDLE; return; } Square rayHitedSquare = _rayShooter.RayCastSquare( ); //離したときにマスがなかったら if (rayHitedSquare == null) { HandCardRestore( ); _handCard.gameObject.GetComponent <BoxCollider2D>( ).enabled = true; _mainPhaseStatus = MAIN_PHASE_STATUS.IDLE; return; } //召喚 for (int i = 0; i < summonableSquares.Count; i++) { if (rayHitedSquare.Index != summonableSquares[i].Index) { continue; } _turnPlayer.SquareChangeColor(summonableSquares, false); _turnPlayer.Summon(_handCard, rayHitedSquare, _turnPlayer.gameObject.tag); _handCard = null; _mainPhaseStatus = MAIN_PHASE_STATUS.IDLE; return; } _turnPlayer.SquareChangeColor(summonableSquares, false); HandCardRestore( ); _mainPhaseStatus = MAIN_PHASE_STATUS.IDLE; }
//-------------------------------------------------- //フィールドのカードがタッチされたら処理------------------------ void FieldCardTouch( ) { //カードとそのマスの取得 _nowSquare = _rayShooter.RayCastSquare( ); if (_nowSquare == null) { return; } _card = _nowSquare.On_Card; if (_card == null) { return; } ShowCardDetails( ); //カードの詳細画像の表示 ShowCardOperationUI( ); //プレイヤーによって表示するUI _mainPhaseStatus = MAIN_PHASE_STATUS.CARD_DETAILS; }
//--------------------------------------------------------------------------------------------------- //回復効果中処理---------------------------------------------- void RecoveryEffect( ) { if (_mainSceneOperation.BackButtonClicked( )) { _uiActiveManager.AllButtonActiveChanger(false); GetDataReset( ); _mainPhaseStatus = MAIN_PHASE_STATUS.IDLE; return; } if (_mainSceneOperation.EffectYesButtonClicked( )) { _turnPlayer.UseEffect(_card); _uiActiveManager.AllButtonActiveChanger(false); GetDataReset( ); _mainPhaseStatus = MAIN_PHASE_STATUS.IDLE; return; } }
//-------------------------------------------------------------------------------- //カード移動状態処理---------------------------------------------------------------------------------------------------------------- void MoveCardStatus( ) { List <Square> squares = _field.MovePossibleSquare(_card, _card.Card_Data._directionOfTravel, _nowSquare); _turnPlayer.SquareChangeColor(squares, true); //移動できるマスの色を変える if (_mainSceneOperation.MouseTouch( )) { Square square = _rayShooter.RayCastSquare( ); //マウスをクリックしたらレイを飛ばしてマスを取得する _turnPlayer.SquareChangeColor(squares, false); //色をもとに戻す _uiActiveManager.ButtonActiveChanger(false, UIActiveManager.BUTTON.BACK); if (square != null) { _turnPlayer.MoveCard(_card, _card.Card_Data._directionOfTravel, _card.Card_Data._necessaryAP, _nowSquare, square); //移動できるかどうかを判定し移動できたら移動する } //情報リセット GetDataReset( ); _mainPhaseStatus = MAIN_PHASE_STATUS.IDLE; return; } //戻るボタンを押したら if (_mainSceneOperation.BackButtonClicked( )) { _uiActiveManager.ButtonActiveChanger(false, UIActiveManager.BUTTON.BACK); _turnPlayer.SquareChangeColor(squares, false); //色をもとに戻す //情報リセット GetDataReset( ); _mainPhaseStatus = MAIN_PHASE_STATUS.IDLE; return; } }
//----------------------------------------------------------------------------- //ボタン操作処理------------------------------------------------------------ void CardDetailsStatus( ) { //戻るボタンを押したら if (_mainSceneOperation.BackButtonClicked( )) { _uiActiveManager.AllButtonActiveChanger(false); _card.DeleteCardDetail( ); GetDataReset( ); _mainPhaseStatus = MAIN_PHASE_STATUS.IDLE; return; } //移動ボタンを押したら if (_mainSceneOperation.MoveButtonClicked( )) { _uiActiveManager.ButtonActiveChanger(false, UIActiveManager.BUTTON.MOVE, UIActiveManager.BUTTON.DIRECT_ATTACK, UIActiveManager.BUTTON.EFFECT); _card.DeleteCardDetail( ); _mainPhaseStatus = MAIN_PHASE_STATUS.CARD_MOVE; return; } //攻撃ボタンを押したら if (_mainSceneOperation.AttackButtonClicked( )) { _uiActiveManager.AllButtonActiveChanger(false); _mainPhaseStatus = MAIN_PHASE_STATUS.DIRECT_ATTACK; _card.DeleteCardDetail( ); return; } //効果ボタンを押したら if (_mainSceneOperation.EffectButtonClicked( )) { _uiActiveManager.ButtonActiveChanger(false, UIActiveManager.BUTTON.MOVE, UIActiveManager.BUTTON.DIRECT_ATTACK, UIActiveManager.BUTTON.EFFECT); //効果の種類によって処理を変える switch (_card.Card_Data._effect_type) { case CardData.EFFECT_TYPE.ATTACK: _uiActiveManager.ButtonActiveChanger(true, UIActiveManager.BUTTON.EFFECT_YES); _mainPhaseStatus = MAIN_PHASE_STATUS.EFFECT_ATTACK; break; case CardData.EFFECT_TYPE.MOVE: _mainPhaseStatus = MAIN_PHASE_STATUS.EFFECT_MOVE; break; case CardData.EFFECT_TYPE.RECOVERY: _uiActiveManager.ButtonActiveChanger(true, UIActiveManager.BUTTON.EFFECT_YES); _mainPhaseStatus = MAIN_PHASE_STATUS.EEFECT_RECOVERY; break; default: Debug.Log("想定していない効果がステータスに来ています"); break; } _card.DeleteCardDetail( ); return; } }