void RegisterPlayer()
        {
            ID = "Playa" + _inputManager.PlayerNum;
            transform.name = ID;
            nickname = ID;

            scoreManager = GameObject.Find ("Score Manager").GetComponent<ScoreManagerCouch> ();

            networkManager = GameObject.Find ("_NetworkManager");
            _networkController = networkManager.GetComponent<PlayersManager> ();
            _networkController.RegisterOfflinePlayer (ID);
        }
示例#2
0
        public void GetObjects()
        {
            Debug.Log ("GetCharacters local ");
            _OfflinePlayerController = GetComponent<OfflinePlayerController> ();
            ID = _OfflinePlayerController.ID;
            networkManager = GameObject.Find ("_NetworkManager");
            _networkController = networkManager.GetComponent<PlayersManager> ();
            foreach (Transform child in transform) {
                if (child.gameObject.CompareTag (Tags.Character)) {
                    character = child.gameObject;
                    audioSource = child.gameObject.GetComponent<AudioSource> ();
                }
            }

            PlaySound (ID, SoundTypes.Spawning, audioSource);
        }
示例#3
0
		public void Init ()
		{
			if (initialized)
				return;
			
			playerObjects = GetComponent<PlayerObjectReferences>();

			_scoreManager = FindObjectOfType<ScoreManager> ();
			if (_scoreManager != null && base.isServer)
				_scoreManager.OnRoundStart += Revive;

			killsFeed = FindObjectsOfType<ChatEnterer> ().FirstOrDefault(c => c.feedType == ChatFeederTypes.Kills);
			chatFeed = FindObjectsOfType<ChatEnterer> ().FirstOrDefault(c => c.feedType == ChatFeederTypes.Chat);

			characterLoader = playerObjects.transform.GetComponent<CharacterLoader>();


			// fill health and ammo
			health = maxHealth;
			ammo = maxAmmo;

			//find start positions
			_startPositions = GameObject.FindGameObjectsWithTag (Tags.SpawnPoint);


			_character = playerObjects.character;
			selfInjury = _character.injurator;
		
			//find audio network sync
			_audioPlayer = GetComponent<AudioPlayerCharacter> ();

			_playersManager = FindObjectOfType <PlayersManager> ();
			_hudController = FindObjectOfType<HudController> ();
			statusIndicators = playerObjects.statusIndicators;

			if (base.isLocalPlayer) {
				
				Cmd_GetPlayers ();

				if (chatFeed != null) {
					chatFeed.OnPostChatMessage += PostChatMessage;
				}
			}
				
			
			Revive ();

			StartCoroutine(CleareMessagesCount());

			initialized = true;

            /* events */
            JetsonsAnalytics.LogEquipment();

		}
示例#4
0
		public void Cmd_GetPlayers ()
		{
			if (_playersManager == null)
				_playersManager = FindObjectOfType <PlayersManager> ();

			for (int i = 0; i < _playersManager.players.Length; i++) {
				
				_playersManager.players [i].gameObject.GetComponent<Combat> ().Rpc_GetPlayers ();
			}
		}
示例#5
0
 public void Init()
 {
     _multiplayerPlayerController = GetComponent<MultiplayerPlayerController> ();
     _playersManager = FindObjectOfType<PlayersManager> ();
 }
示例#6
0
 void Awake()
 {
     if (Instance == null) Instance = this;
     else {
         Destroy(this.gameObject);
         return;
     }
     DontDestroyOnLoad(gameObject);
 }
示例#7
0
 void Start()
 {
     m_playersManager = FindObjectOfType<PlayersManager>();
 }
示例#8
0
 void Start()
 {
     m_playersManager = FindObjectOfType<PlayersManager>();
     m_audioSource = GetComponent<AudioSource>();
     m_audioDirector = FindObjectOfType<AudioDirector>();
 }
示例#9
0
		// Use this for initialization
		public void Init ()
		{
			_networkController = FindObjectOfType<PlayersManager> ();
			audioPlayer = GetComponent<AudioPlayerCharacter> ();
			initialized = true;
		}