コード例 #1
0
 void Awake()
 {
     _camera    = GameObject.Find("P1/P1 Cam");
     count      = GameSetting.Characters.GetValues(typeof(GameSetting.Characters)).Length;
     _animators = new Animator[count];
     _targets   = new GameObject[count];
     for (int i = 0; i < count; i++)
     {
         GameSetting.Characters character = (GameSetting.Characters)i;
         _targets[i]   = GameObject.Find("P1/" + character.ToString());
         _animators[i] = _targets[i].transform.Find("model").GetComponent <Animator>();
         _animators[i].Play("Idle");
     }
 }
コード例 #2
0
    void Awake()
    {
        GameSetting.Characters char_p1 = (GameSetting.Characters)GameSetting.selec_p1;
        GameSetting.Characters char_p2 = (GameSetting.Characters)GameSetting.selec_p2;
        Vector3 pos_p1 = GameObject.Find("P1/ReviveY").transform.position;
        Vector3 pos_p2 = GameObject.Find("P2/ReviveY").transform.position;

        Player1 = Instantiate(Resources.Load("Prefabs/" + char_p1.ToString()), pos_p1, Quaternion.identity) as GameObject;
        Player2 = Instantiate(Resources.Load("Prefabs/" + char_p2.ToString()), pos_p2, Quaternion.identity) as GameObject;

        Player1.name             = "Player1"; // name을 변경
        Player1.transform.parent = GameObject.Find("P1").transform;
        Player1.AddComponent <Player1>();
        Player2.name             = "Player2"; // name을 변경
        Player2.transform.parent = GameObject.Find("P2").transform;
        Player2.AddComponent <Player2>();
        //joohan 추가
        GameObject.Find("Canvas/restartButton").GetComponent <Image>().enabled     = false;
        GameObject.Find("Canvas/restartButton").GetComponent <Button>().enabled    = false;
        GameObject.Find("Canvas/restartButton/Text").GetComponent <Text>().enabled = false;
    }