コード例 #1
0
 // Use this for initialization
 void Start()
 {
     rb             = GetComponent <Rigidbody2D>();
     audioSource    = GetComponent <AudioSource>();
     player         = GameObject.FindObjectOfType <NinjaControllerScript>();
     box            = GetComponent <BoxCollider2D>();
     spriteRenderer = GetComponent <SpriteRenderer>();
 }
コード例 #2
0
    // Use this for initialization
    void Start()
    {
        if(player1 != null)
        {
            stats1 = player1.GetComponent<NinjaControllerScript> ();

        }
        stats2 = player2.GetComponent<NinjaControllerScript> ();
        backgroundInverter = background.GetComponent < BackgroundInverter> ();
    }
コード例 #3
0
 // Use this for initialization
 void Start()
 {
     if(photonView.isMine)
     {
         //myCamera = GameObject.Find("../My Camera");
         //myCamera.SetActive(true);
         controller = GetComponent<NinjaControllerScript>();
         //controller.enabled = true;
     }
     else
     {
         controller = GetComponent<NinjaControllerScript>();
         StartCoroutine("Alive");
     }
 }
コード例 #4
0
    // Use this for initialization
    void Start()
    {
        PhotonNetwork.ConnectUsingSettings(VERSION);
        scenePhotonView = this.GetComponent<PhotonView>();

        if(player1 != null)
        {
            stats1 = player1.GetComponent<NinjaControllerScript> ();

        }
        if (player2 != null)
        {
            stats2 = player2.GetComponent<NinjaControllerScript> ();
        }
        backgroundInverter = background.GetComponent < BackgroundInverter> ();
    }
コード例 #5
0
    void OnJoinedRoom()
    {
        Debug.Log ("Number of players in room: " + PhotonNetwork.playerList.Length);
        if (PhotonNetwork.playerList.Length == 1) {
            GameObject blackNinja = PhotonNetwork.Instantiate (playerPrefabName, blackSpawnPoint.position, blackSpawnPoint.rotation, 0);
            player1 = blackNinja.transform;
            stats1 = player1.GetComponent<NinjaControllerScript> ();
            stats1.isControllable = true;
        } else if (PhotonNetwork.playerList.Length == 2) {
            //Debug.Log("I'm in 2");
            GameObject whiteNinja = PhotonNetwork.Instantiate (player2PrefabName, whiteSpawnPoint.position, whiteSpawnPoint.rotation, 0);
            player2 = whiteNinja.transform;
            stats2 = player2.GetComponent<NinjaControllerScript> ();
            stats2.isControllable = true;
            StartCoroutine(findSecondPlayer(1));
        }

        /*if (PhotonNetwork.playerList.Length == 1)
        {
            playerWhoIsIt = PhotonNetwork.player.ID;
        }

        Debug.Log("playerWhoIsIt: " + playerWhoIsIt);*/
    }
コード例 #6
0
 IEnumerator findSecondPlayer(int playerNumber)
 {
     if (playerNumber == 1) {
         while (GameObject.Find("Black Ninja(Clone)") == null) {
             //Debug.Log("Haven't found it");
             yield return null;
         }
         if (GameObject.Find ("Black Ninja(Clone)") != null) {
             GameObject blackNinja = GameObject.Find ("Black Ninja(Clone)");
             player1 = blackNinja.transform;
             stats1 = player1.GetComponent<NinjaControllerScript> ();
             //Debug.Log("Found it");
             yield return null;
         }
     } else if (playerNumber == 2) {
         while (GameObject.Find("White Ninja(Clone)") == null) {
             //Debug.Log("Haven't found it");
             yield return null;
         }
         if (GameObject.Find ("White Ninja(Clone)") != null) {
             GameObject whitenNinja = GameObject.Find ("White Ninja(Clone)");
             player2 = whitenNinja.transform;
             stats2 = player2.GetComponent<NinjaControllerScript> ();
             //Debug.Log("Found it");
             yield return null;
         }
     }
 }
コード例 #7
0
 // Use this for initialization
 void Start()
 {
     player = FindObjectOfType <NinjaControllerScript> ();
     key    = FindObjectOfType <Coin> ();
 }