Пример #1
0
    void ShowResult()
    {
        Time.timeScale = 1f;
        // 勝った方のキャラのWinモーション再生
        GameObject winPlayer = GameObject.FindWithTag(winPlayerTag);

        winPlayer.transform.Find("UTC_Default").gameObject.GetComponent <Animator>().SetTrigger("Win");
        winPlayer.transform.eulerAngles = new Vector3(0, 180, 0);
        resultCanvas.SetActive(true);
        if (winPlayerTag == "myPlayer")
        {
            // 自分が勝った
            resultText.text      = "You Win!";
            ResultManager.result = "WIN";
            AudioClip clip = winVoice[OfflineCharaSet.GetCharaNum(myPlayerPlayerController.chara)];
            AudioSourceManager.PlayVOICE(clip);
            AudioSourceManager.audioBGM.loop = false;
            AudioSourceManager.PlayBGM(endBGMs[0]);
        }
        else
        {
            // 相手が勝った
            resultText.text                  = "You Lose...";
            ResultManager.result             = "LOSE";
            AudioSourceManager.audioBGM.loop = false;
            AudioSourceManager.PlayBGM(endBGMs[1]);
        }
    }
Пример #2
0
    void Start()
    {
        // 端末内保存情報からユーザー情報を抽出
        id         = PlayerPrefs.GetString("ID");
        playerName = PlayerPrefs.GetString("PlayerName");
        winCount   = PlayerPrefs.GetInt("WinCount");
        loseCount  = PlayerPrefs.GetInt("LoseCount");
        playCount  = winCount + loseCount;
        if (playCount == 0)
        {
            winPercent = 0;
        }
        else
        {
            winPercent = (float)winCount / playCount;
        }
        // UI表示
        nameText.text           = playerName;
        countText.text          = winCount.ToString().PadLeft(3, '0') + "勝 / " + loseCount.ToString().PadLeft(3, '0') + "敗";
        percentGraoh.fillAmount = winPercent;
        percentText.text        = (winPercent * 100).ToString("f1") + "%";

        inputCanvas.enabled = false;

        GetRanking();

        AudioSourceManager.PlayBGM(bgm);
    }
Пример #3
0
 void BattleStart()
 {
     mainCanvas.SetActive(true);
     AudioSourceManager.PlayVOICE(startVoices[3]);
     AudioSourceManager.PlayBGM(battleBGM);
     OfflineManager.isPlaying = true;
     GameObject.FindWithTag("myPlayer").GetComponent <OfflinePlayerController>().joystick = GameObject.Find("Joystick").GetComponent <Joystick>();
 }
Пример #4
0
    void BattleReady()
    {
        phase = PHASE.isReady;

        myPlayerPlayerController    = GameObject.FindWithTag("myPlayer").GetComponent <PlayerController>();
        enemyPlayerPlayerController = GameObject.FindWithTag("enemyPlayer").GetComponent <PlayerController>();
        enemyPlayerPlayerController.SetChara("enemyPlayer");
        ResultManager.enemyName = enemyPlayerPlayerController.playerName;

        Destroy(matchingCanvas);
        battleStartPanelAnim.Play();
        battleStartCanvasAnim.Play();
        AudioSourceManager.PlayBGM(startBGM);
    }
Пример #5
0
    void Start()
    {
        PhotonManager.phase      = PhotonManager.PHASE.other;
        OfflineManager.isPlaying = false;

        int chara        = PlayerPrefs.GetInt("chara", 0);
        int hairColor    = PlayerPrefs.GetInt("hair", 0);
        int eyeColor     = PlayerPrefs.GetInt("eye", 0);
        int costumeColor = PlayerPrefs.GetInt("costume", 0);

        GameObject charaObj = Instantiate(Resources.Load("CharaPrefabs/chara" + chara) as GameObject);

        charaObj.transform.position    = new Vector3(-0.5f, 0, 0);
        charaObj.transform.eulerAngles = new Vector3(0, 140, 0);
        charaObj.transform.localScale  = new Vector3(1.2f, 1.2f, 1.2f);
        Destroy(charaObj.GetComponent <AnimationEventScript>());

        if (chara == 0)
        {
            charaObj.transform.Find("costume").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/costume_unity" + costumeColor) as Material;
        }
        else
        {
            charaObj.transform.Find("costume").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/costume_school" + costumeColor) as Material;
        }
        switch (OfflineCharaSet.GetCharaNum(chara))
        {
        case 0:
            charaObj.transform.Find("hair").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/unity" + hairColor) as Material;
            charaObj.transform.Find("eye").gameObject.GetComponent <SkinnedMeshRenderer>().material  = Resources.Load("Materials/unity" + eyeColor) as Material;
            break;

        case 1:
            charaObj.transform.Find("hair").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/misaki" + hairColor) as Material;
            charaObj.transform.Find("eye").gameObject.GetComponent <SkinnedMeshRenderer>().material  = Resources.Load("Materials/misaki" + eyeColor) as Material;
            break;

        case 2:
            charaObj.transform.Find("hair").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/yuko" + hairColor) as Material;
            charaObj.transform.Find("eye").gameObject.GetComponent <SkinnedMeshRenderer>().material  = Resources.Load("Materials/yuko" + eyeColor) as Material;
            break;
        }

        AudioSourceManager.PlayBGM(bgm);
    }
Пример #6
0
    void Start()
    {
        phase = PHASE.yetJoinedRoom;
        OfflineManager.isPlaying = false;

        matchingCanvas.SetActive(true);
        statusText.text = "";
        stopCanvas.SetActive(false);
        statusText1.text = "";
        statusText2.text = "";
        mainCanvas.SetActive(false);
        resultCanvas.SetActive(false);
        ResultManager.result    = "";
        ResultManager.enemyName = "";

        ConnectPhoton();

        AudioSourceManager.PlayBGM(matchingBGM);
    }
Пример #7
0
    void Start()
    {
        chara        = PlayerPrefs.GetInt("chara", 0);
        hairColor    = PlayerPrefs.GetInt("hair", 0);
        eyeColor     = PlayerPrefs.GetInt("eye", 0);
        costumeColor = PlayerPrefs.GetInt("costume", 0);
        for (int i = 0; i < CHARA_MAX; i++)
        {
            charaChildObjs[i, 0] = charaObjs[i].transform.Find("_root").gameObject;
            charaChildObjs[i, 1] = charaObjs[i].transform.Find("costume").gameObject;
            charaChildObjs[i, 2] = charaObjs[i].transform.Find("eye").gameObject;
            charaChildObjs[i, 3] = charaObjs[i].transform.Find("hair").gameObject;
            // 0 : 顔
            // 1 : 服
            // 2 : 目
            // 3 : 髪
        }
        SetChara();
        SetHairColor();
        SetEyeColor();
        SetCostumeColor();

        AudioSourceManager.PlayBGM(bgm);
    }
Пример #8
0
    public void BattleStart()
    {
        phase = PHASE.isPlaying;
        AudioSourceManager.PlayBGM(battleBGM);
        AudioSourceManager.PlayVOICE(startVoices[3]);

        mainCanvas.SetActive(true);
        myPlayerPlayerController.joystick = GameObject.Find("Joystick").GetComponent <Joystick>();

        if (GameObject.FindWithTag("myPlayer").transform.position.x < 0)
        {
            myHpbar        = GameObject.Find("1PHPbar").GetComponent <Image>();
            enemyHpbar     = GameObject.Find("2PHPbar").GetComponent <Image>();
            myHpbarText    = GameObject.Find("1PHPtext").GetComponent <Text>();
            enemyHpbarText = GameObject.Find("2PHPtext").GetComponent <Text>();
            myApbar        = GameObject.Find("1PAPbar").GetComponent <Image>();
            enemyApbar     = GameObject.Find("2PAPbar").GetComponent <Image>();
            myApbarText    = GameObject.Find("1PAPtext").GetComponent <Text>();
            enemyApbarText = GameObject.Find("2PAPtext").GetComponent <Text>();
            GameObject.Find("1Pname").GetComponent <Text>().text = myPlayerPlayerController.playerName;
            GameObject.Find("2Pname").GetComponent <Text>().text = enemyPlayerPlayerController.playerName;
        }
        else
        {
            myHpbar        = GameObject.Find("2PHPbar").GetComponent <Image>();
            enemyHpbar     = GameObject.Find("1PHPbar").GetComponent <Image>();
            myHpbarText    = GameObject.Find("2PHPtext").GetComponent <Text>();
            enemyHpbarText = GameObject.Find("1PHPtext").GetComponent <Text>();
            myApbar        = GameObject.Find("2PAPbar").GetComponent <Image>();
            enemyApbar     = GameObject.Find("1PAPbar").GetComponent <Image>();
            myApbarText    = GameObject.Find("2PAPtext").GetComponent <Text>();
            enemyApbarText = GameObject.Find("1PAPtext").GetComponent <Text>();
            GameObject.Find("2Pname").GetComponent <Text>().text = myPlayerPlayerController.playerName;
            GameObject.Find("1Pname").GetComponent <Text>().text = enemyPlayerPlayerController.playerName;
        }
    }
Пример #9
0
    void Start()
    {
        if (result != "WIN" && result != "LOSE")
        {
            result = "WIN";
        }
        if (result == "WIN")
        {
            resultText.text = "You Win!";
        }
        else if (result == "LOSE")
        {
            resultText.text = "You Lose...";
        }

        // 端末内保存情報からユーザー情報を抽出
        id        = PlayerPrefs.GetString("ID");
        winCount  = PlayerPrefs.GetInt("WinCount");
        loseCount = PlayerPrefs.GetInt("LoseCount");
        playCount = winCount + loseCount;
        if (playCount == 0)
        {
            winPercent = 0;
        }
        else
        {
            winPercent = (float)winCount / playCount;
        }
        // 更新後のユーザーデータ
        if (result == "WIN")
        {
            newWinCount  = winCount + 1;
            newLoseCount = loseCount;
        }
        else if (result == "LOSE")
        {
            newLoseCount = loseCount + 1;
            newWinCount  = winCount;
        }
        newPlayCount  = newWinCount + newLoseCount;
        newWinPercent = (float)newWinCount / newPlayCount;

        // キャラのセット
        int chara        = PlayerPrefs.GetInt("chara", 0);
        int hairColor    = PlayerPrefs.GetInt("hair", 0);
        int eyeColor     = PlayerPrefs.GetInt("eye", 0);
        int costumeColor = PlayerPrefs.GetInt("costume", 0);

        GameObject charaObj = Instantiate(Resources.Load("CharaPrefabs/chara" + chara) as GameObject);

        charaObj.transform.position    = new Vector3(-0.4f, 0, 0);
        charaObj.transform.eulerAngles = new Vector3(0, 180, 0);
        Destroy(charaObj.GetComponent <AnimationEventScript>());

        if (chara == 0)
        {
            charaObj.transform.Find("costume").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/costume_unity" + costumeColor) as Material;
        }
        else
        {
            charaObj.transform.Find("costume").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/costume_school" + costumeColor) as Material;
        }
        switch (OfflineCharaSet.GetCharaNum(chara))
        {
        case 0:
            charaObj.transform.Find("hair").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/unity" + hairColor) as Material;
            charaObj.transform.Find("eye").gameObject.GetComponent <SkinnedMeshRenderer>().material  = Resources.Load("Materials/unity" + eyeColor) as Material;
            break;

        case 1:
            charaObj.transform.Find("hair").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/misaki" + hairColor) as Material;
            charaObj.transform.Find("eye").gameObject.GetComponent <SkinnedMeshRenderer>().material  = Resources.Load("Materials/misaki" + eyeColor) as Material;
            break;

        case 2:
            charaObj.transform.Find("hair").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/yuko" + hairColor) as Material;
            charaObj.transform.Find("eye").gameObject.GetComponent <SkinnedMeshRenderer>().material  = Resources.Load("Materials/yuko" + eyeColor) as Material;
            break;
        }

        AudioSourceManager.PlayBGM(bgm);
        if (result == "WIN")
        {
            charaObj.GetComponent <Animator>().SetTrigger("Win");
            AudioSourceManager.PlayVOICE(winVoice[OfflineCharaSet.GetCharaNum(chara)]);
        }
        else if (result == "LOSE")
        {
            charaObj.GetComponent <Animator>().SetTrigger("Lose");
            AudioSourceManager.PlayVOICE(loseVoice[OfflineCharaSet.GetCharaNum(chara)]);
        }
    }
Пример #10
0
 void StartBGMPlay()
 {
     AudioSourceManager.PlayBGM(startBGM);
 }