コード例 #1
0
    // Use this for initialization
    void Start()
    {
        float highscore = ResultScene.ToScore();

        Title.SetActive(true);
        PtoS.SetActive(true);
        HighScore.SetActive(true);
        HighScore.GetComponent <Text>().text = "さいそく:" + highscore.ToString("f1") + " びょう";

        GameOver.SetActive(false);
        HP_1.SetActive(false);
        HP_2.SetActive(false);
        HP_3.SetActive(false);
        HP_4.SetActive(false);
        Life.SetActive(false);

        loadScene = SceneManager.GetActiveScene();
    }
コード例 #2
0
    private void Awake()
    {
        calculationDone             = false;
        cassette.transform.position = new Vector3(0, 20, 0);
        points    = GameManager.Instance.points;
        threshold = Mathf.Min(points[0], points[1]) * 9 / 10;

        for (int i = 0; i < points[0]; i++)
        {
            lPoints.Add(Instantiate(cassette));
        }
        for (int i = 0; i < points[1]; i++)
        {
            rPoints.Add(Instantiate(cassette));
        }
        this.StartCoroutine(CalculateLPoints());
        this.StartCoroutine(CalculateRPoints());
        rs = this.GetComponent <ResultScene>();
    }
コード例 #3
0
    void UpdateResult()
    {
        GameObject obj = GameObject.Find("ResultScene");

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

            //득점 판정 전에 이전 득점을 기억해 둡니다.
            int[] prevScores = { m_score[0], m_score[1] };
            // 이긴 쪽에 포인트가 들어갑니다.
            if (m_actionWinner == Winner.ServerPlayer)
            {
                ++m_score[0];
            }
            else if (m_actionWinner == Winner.ClientPlayer)
            {
                ++m_score[1];
            }

            //자신의 승패를 구합니다.
            ResultScene.Result ownResult = ResultScene.Result.Lose;
            if (m_actionWinner == Winner.Draw)
            {
                ownResult = ResultScene.Result.Draw;
            }
            else if (m_playerId == 0 && m_actionWinner == Winner.ServerPlayer)
            {
                ownResult = ResultScene.Result.Win;
            }
            else if (m_playerId == 1 && m_actionWinner == Winner.ClientPlayer)
            {
                ownResult = ResultScene.Result.Win;
            }

            //연출 시작.
            obj.GetComponent <ResultScene>().Setup(prevScores, m_score, ownResult);
            return;
        }

        //연출 대기.
        ResultScene resultScene = obj.GetComponent <ResultScene>();

        if (resultScene.IsEnd())
        {
            Debug.Log("result end");
            if (m_score[0] == PLAY_MAX || m_score[1] == PLAY_MAX)
            {
                // 모든 대전이 끝난 경우는 게임 종료입니다.
                GameObject.Find("BGM").SendMessage("FadeOut"); //BGM.
                m_gameState = GameState.EndGame;
            }
            else
            {
                // 다음 대전으로 진행합니다.
                Reset();
                m_gameState = GameState.Ready;
            }

            //뒷처리.
            Destroy(obj);
        }
    }
コード例 #4
0
 public override void Initialize(SceneController scene)
 {
     m_scene = (ResultScene)scene;
 }