Exemple #1
0
 void CalculateWinner()
 {
     if (selectedRPS != RPSKind.None && selectedOppRPS != RPSKind.None)
     {
         isCheckWinner = true;
         winner        = ResultChecker.GetRPSWinner(selectedRPS, selectedOppRPS);
         Debug.Log("계산완료  " + winner);
     }
 }
Exemple #2
0
    public void ChangeAnimationAction(ActionKind action)
    {
        //서버 클라이언트에서의 판정만 할 수 있으므로 Winner.serverPlayer면 자신의 승리로 다룹니다.
        Winner rpsWinner = ResultChecker.GetRPSWinner(m_rps, m_opponentRps);

        switch (rpsWinner)
        {
        case Winner.ServerPlayer:   //가위바위보는 자신의 승리.
            if (action == ActionKind.Attack)
            {
                ChangeAnimationAttack();
            }
            else if (action == ActionKind.Block)
            {
                ChangeAnimation(Motion.Defence);
            }
            break;

        case Winner.ClientPlayer:   //가위바위보는 자신의 패배.
            if (action == ActionKind.Attack)
            {
                ChangeAnimationMiss();
            }
            else if (action == ActionKind.Block)
            {
                ChangeAnimation(Motion.Defence);
            }
            break;

        case Winner.Draw:           //가위바위보는 무승부.
            if (action == ActionKind.Attack)
            {
                ChangeAnimationMiss();
            }
            else if (action == ActionKind.Block)
            {
                ChangeAnimation(Motion.Defence);
            }
            break;
        }
        //Debug.Log(m_currentMotion.ToString() + m_anim[m_currentMotion.ToString()].length);
        //Debug.Log(m_anim[m_currentMotion.ToString()].speed);
        //Debug.Log(m_anim[m_currentMotion.ToString()].normalizedTime);

        m_anim[m_currentMotion.ToString()].speed = 0.1f; //느리게 재생.
    }
Exemple #3
0
    //공격・방어 애니메이션 연출 대기.
    void UpdateEndAction()
    {
        GameObject obj = GameObject.Find("ActionController");

        if (obj == null)
        {
            //연출용 오브젝트가 없으면 생성합니다(이 시퀀스의 초기 동작입니다).
            obj      = Instantiate(m_actionControllerPrefab) as GameObject;
            obj.name = "ActionController";

            //연출을 위해 승패 판정을 합니다.
            InputData serverPlayer = m_inputData[0];
            InputData clientPlayer = m_inputData[1];

            //가위바위보 판정.
            Winner rpsWinner = ResultChecker.GetRPSWinner(serverPlayer.rpsKind, clientPlayer.rpsKind);
            //공방 속도 판정.
            m_actionWinner = ResultChecker.GetActionWinner(serverPlayer.attackInfo, clientPlayer.attackInfo, rpsWinner);
            Debug.Log("RPS Winner:" + rpsWinner.ToString() + " ActionWinner" + m_actionWinner.ToString());

            //연출 시작.
            obj.GetComponent <ActionController>().Setup(
                m_actionWinner, m_score[0], m_score[1]
                );
            return;
        }

        //전투 연출이 끝나길 기다립니다.
        ActionController actionController = obj.GetComponent <ActionController>();

        if (actionController.IsEnd())
        {
            //뒷처리.
            Destroy(GameObject.Find("BattleSelect"));       //공수선택 표시물을 지운다.
            Destroy(GameObject.Find("ActionController"));   //연출 제어를 제거.

            //m_timer = 0.0f;
            m_gameState = GameState.Result;
        }
    }