コード例 #1
0
ファイル: PhotonManager.cs プロジェクト: aimy-07/UniFight
    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
ファイル: CharaIdleScript.cs プロジェクト: aimy-07/UniFight
    public void VoiceButton()
    {
        int rand  = Random.Range(0, 6);
        int chara = PlayerPrefs.GetInt("chara", 0);

        for (int i = 0; i < SelectCostumeManager.CHARA_MAX; i++)
        {
            animators[i].SetTrigger(rand.ToString());
        }
        switch (OfflineCharaSet.GetCharaNum(chara))
        {
        case 0:
            AudioSourceManager.PlayVOICE(unityVoice[rand]);
            break;

        case 1:
            AudioSourceManager.PlayVOICE(misakiVoice[rand]);
            break;

        case 2:
            AudioSourceManager.PlayVOICE(yukoVoice[rand]);
            break;
        }
        t = 1;
    }
コード例 #3
0
ファイル: PhotonManager.cs プロジェクト: aimy-07/UniFight
 public void RightVoicePlay()
 {
     if (GameObject.FindWithTag("myPlayer").transform.position.x > 0)
     {
         AudioClip clip = startVoices[OfflineCharaSet.GetCharaNum(myPlayerPlayerController.chara)];
         AudioSourceManager.PlayVOICE(clip);
     }
     else
     {
         AudioClip clip = startVoices[OfflineCharaSet.GetCharaNum(enemyPlayerPlayerController.chara)];
         AudioSourceManager.PlayVOICE(clip);
     }
 }
コード例 #4
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);
    }
コード例 #5
0
ファイル: PhotonManager.cs プロジェクト: aimy-07/UniFight
    // どちらかのHPが0になったら呼ばれる
    void BattleEnd(string losePlayerTag)
    {
        phase = PHASE.isEnded;
        AudioSourceManager.audioBGM.Stop();
        if (losePlayerTag == "myPlayer")
        {
            winPlayerTag = "enemyPlayer";
        }
        else
        {
            winPlayerTag = "myPlayer";
        }
        GameObject cam      = GameObject.Find("Main Camera");
        GameObject myPlayer = GameObject.FindWithTag("myPlayer");
        float      cam_x;

        if (winPlayerTag == "myPlayer")
        {
            // 自分が勝った
            cam_x = myPlayer.transform.position.x;
            AudioClip clip = attackVoice[OfflineCharaSet.GetCharaNum(myPlayerPlayerController.chara)];
            AudioSourceManager.PlayVOICE(clip);
        }
        else
        {
            // 自分が負けた
            if (myPlayer.transform.rotation.y > 0)
            {
                cam_x = myPlayer.transform.position.x - 0.4f;
            }
            else
            {
                cam_x = myPlayer.transform.position.x + 0.4f;
            }
            AudioClip clip = damageVoice[OfflineCharaSet.GetCharaNum(myPlayerPlayerController.chara)];
            AudioSourceManager.PlayVOICE(clip);
        }
        cam.transform.position    = new Vector3(cam_x, 1.5f, -10);
        cam.transform.eulerAngles = new Vector3(6, 0, 0);
        cam.GetComponent <Camera>().orthographicSize = 0.6f;
        Time.timeScale = 0.5f;
        mainCanvas.SetActive(false);
        Invoke("ShowResult", 0.8f);
    }
コード例 #6
0
    public void SetHairColor()
    {
        if (hairColor <= 5 ||
            hairColor == 6 && LockedCostume.set_black_locked == 1)
        {
            switch (OfflineCharaSet.GetCharaNum(chara))
            {
            case 0:
                charaChildObjs[chara, 3].GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/unity" + hairColor) as Material;
                break;

            case 1:
                charaChildObjs[chara, 3].GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/misaki" + hairColor) as Material;
                break;

            case 2:
                charaChildObjs[chara, 3].GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/yuko" + hairColor) as Material;
                break;
            }
            PlayerPrefs.SetInt("hair", hairColor);
        }
        hairColorSelectImage.sprite = hairEyeColorSprites[hairColor];
        lockedCostume.LockedHairColor(hairColor, eyeColor, costumeColor);
    }
コード例 #7
0
    public void SetChara(string tag)
    {
        GameObject charaObj = Instantiate(Resources.Load("CharaPrefabs/chara" + chara) as GameObject);

        charaObj.transform.parent        = GameObject.FindWithTag(tag).transform;
        charaObj.gameObject.name         = "UTC_Default";
        charaObj.transform.localPosition = new Vector3(0, 0, 0);
        charaObj.transform.localRotation = new Quaternion(0, 0, 0, 1);
        animator = charaObj.GetComponent <Animator>();
        charaObj.gameObject.AddComponent <FreezeCharaPosition>();
        charaObj.gameObject.GetComponent <AnimationEventScript>().smallAttackCol = transform.root.gameObject.transform.Find("SmallAttackCollider").gameObject.GetComponent <BoxCollider>();
        charaObj.gameObject.GetComponent <AnimationEventScript>().bigAttackCol   = transform.root.gameObject.transform.Find("BigAttackCollider").gameObject.GetComponent <BoxCollider>();

        GameObject charaImgObj = null;

        if (transform.position.x < 0)
        {
            for (int i = 0; i < SelectCostumeManager.CHARA_MAX; i++)
            {
                if (i == chara)
                {
                    charaImgObj = GameObject.Find("charaLeft" + i);
                }
                else
                {
                    Debug.Log(GameObject.Find("charaLeft" + i));
                    GameObject.Find("charaLeft" + i).SetActive(false);
                }
            }
            GameObject.Find("PlayerNameLeft").GetComponent <Text>().text = playerName;
        }
        else
        {
            for (int i = 0; i < SelectCostumeManager.CHARA_MAX; i++)
            {
                if (i == chara)
                {
                    charaImgObj = GameObject.Find("charaRight" + i);
                }
                else
                {
                    GameObject.Find("charaRight" + i).SetActive(false);
                }
            }
            GameObject.Find("PlayerNameRight").GetComponent <Text>().text = playerName;
        }

        if (chara == 0)
        {
            charaObj.transform.Find("costume").gameObject.GetComponent <SkinnedMeshRenderer>().material    = Resources.Load("Materials/costume_unity" + costumeColor) as Material;
            charaImgObj.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;
            charaImgObj.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;
            charaImgObj.transform.Find("hair").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/unity" + hairColor) as Material;
            charaImgObj.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;
            charaImgObj.transform.Find("hair").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/misaki" + hairColor) as Material;
            charaImgObj.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;
            charaImgObj.transform.Find("hair").gameObject.GetComponent <SkinnedMeshRenderer>().material = Resources.Load("Materials/yuko" + hairColor) as Material;
            charaImgObj.transform.Find("eye").gameObject.GetComponent <SkinnedMeshRenderer>().material  = Resources.Load("Materials/yuko" + eyeColor) as Material;
            break;
        }

        Debug.Log(tag + " : キャラのセッティングが完了しました");
    }
コード例 #8
0
ファイル: ResultManager.cs プロジェクト: aimy-07/UniFight
    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)]);
        }
    }
コード例 #9
0
    void RightVoicePlay()
    {
        AudioClip clip = startVoices[OfflineCharaSet.GetCharaNum(GameObject.FindWithTag("enemyPlayer").GetComponent <OfflineEnemyController>().chara)];

        AudioSourceManager.PlayVOICE(clip);
    }