Ejemplo n.º 1
0
    private void Start()
    {
        GameMusicPlayer.killMusic();
        Screen.orientation = ScreenOrientation.LandscapeLeft;
        win  = 25;
        lose = -25;
        getScore();

        if (PhotonNetwork.player.IsMasterClient)
        {
            t1 = PhotonNetwork.Instantiate("Tower1", new Vector2(-4.16f, 0.3f), Quaternion.identity, 0);
            t2 = PhotonNetwork.Instantiate("Tower2", new Vector2(4.16f, 0.3f), Quaternion.identity, 0);

            t1.name = "Tower1";
            t2.GetComponent <PhotonView>().TransferOwnership(PhotonNetwork.otherPlayers[0]);
            t2.name = "Tower2";
        }

        player1text.text = PhotonNetwork.playerList[1].NickName; //hamit,bug
        player2text.text = PhotonNetwork.playerList[0].NickName;

        p1.text = PhotonNetwork.masterClient.NickName;

        if (PhotonNetwork.player.IsMasterClient)
        {
            p2.text = PhotonNetwork.otherPlayers[0].NickName;
        }
        else
        {
            p2.text = PhotonNetwork.player.NickName;
        }
    }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     gameMusicPlayer      = GameObject.Find("GameMusicPlayer");
     gameMusicPlayerClass = gameMusicPlayer.GetComponent <GameMusicPlayer>();
     friendAudio          = GameObject.Find("FriendAudio").GetComponent <AudioSource>();
     energyAudio          = GameObject.Find("EnergyAudio").GetComponent <AudioSource>();
     enemyAudio           = GameObject.Find("EnemyAudio").GetComponent <AudioSource>();
 }
Ejemplo n.º 3
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(gameObject);
         return;
     }
     _instance = this;
     DontDestroyOnLoad(gameObject);
 }
Ejemplo n.º 4
0
 void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
    // Update is called once per frame
    void Update()
    {
        GameMusicPlayer musicPlayer = FindObjectOfType <GameMusicPlayer>();

        if (musicPlayer)
        {
            musicPlayer.SetVolume(volumeSlider.value);
        }
        else
        {
            Debug.LogWarning("No music player found.");
        }
    }
 private void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(transform.gameObject);
     _audioSource = GetComponent <AudioSource>();
 }
Ejemplo n.º 7
0
 public void goBackToMenu()
 {
     PhotonNetwork.Disconnect();
     SceneManager.LoadScene(1);
     GameMusicPlayer.startMusic();
 }