void Start()
        {
            //if (myColor != null){

            hudController = FindObjectOfType<HudController> ();
            if (transform.parent != null) {
                playerNum = transform.parent.GetComponent<PlayerSelector> ().playerNumber;
                Color startColor = transform.parent.GetComponent<PlayerSelector> ().startColor;
                ChangeColor (startColor);
                hudController.UpdateKillCounterCollor (playerNum, transform.parent.GetComponent<PlayerSelector> ().startColor);
            } else {
                ChangeColor (myColor);
            }
        }
Exemplo n.º 2
0
        public void Init(string[] primaryWeapons = null)
        {
            weaponList = FindObjectOfType<WeaponConfigModel>().GetData(); // WeaponModel.Instance.GetData ();

            _gameController = transform.root.gameObject;
            PlayerObjectReferences playerObjects = _gameController.GetComponent<PlayerObjectReferences>();

            character = playerObjects.character;
            characterWeight = character.weight;
            //get default weapon
            foreach (Transform child in transform) {
                if (child.gameObject.tag == "Weapon") {
                    GameObject weapon = child.gameObject;
                    _weapon = weapon.GetComponent<Weapon> ();
                    UpdateConfiguration ();
                }
            }

            _isOffline = GameObject.FindObjectOfType<PlayersManager> ().isOffline;
            if (_isOffline) {
                // offline
                _isLocalPlayer = true;

                //_combatOffline = _gameController.GetComponent<CombatOffline> ();
                _OfflinePlayerController = _gameController.GetComponent<OfflinePlayerController> ();
                ID = _OfflinePlayerController.ID;
            } else {
                // online
                _MultiplayerPlayerController = _gameController.GetComponent<MultiplayerPlayerController> ();
                _isLocalPlayer = _MultiplayerPlayerController.isLocalPlayer;
                ID = _MultiplayerPlayerController.ID;
                _combat = _gameController.GetComponent<Combat> ();
                _combat.OnGotSpecialWeapon += GotSpecialWeapon;
                _CombatAmmoSync = _gameController.GetComponent<CombatAmmoSync> ();
                _combat.OnRevive += SetInitialWeapons;
            }

            if (_isLocalPlayer) {
                weaponsHud = FindObjectOfType<WeaponsHud> ();

                if (primaryWeapons != null) {
                    equippedPrimaryWeapons = primaryWeapons;
                    SetInitialWeapons();
                }

                hud = FindObjectOfType<HudController> ();
                hud.OnWeaponChanged += SetWeapon;

                weaponsHud.SetWeapon (currentPrimary, WeaponSlots.Primary);
                //weaponsHud.SetWeapon (currentSpecial, WeaponSlots.Special);
                weaponsHud.SetWeapon (currentTossable, WeaponSlots.Tossable);

                weaponsHud.UpdateWeaponInfo (1 , _combat.grenadesAmmo , _combat.maxGrenadesAmmo , WeaponSlots.Tossable);
                weaponsHud.SelectWeapon(WeaponSlots.Primary);

                _combat.OnHoldingDelivery += HoldingDelivery;
            }
        }
Exemplo n.º 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();

		}
Exemplo n.º 4
0
		// Use this for initialization
		void Start () {
			animator = GetComponent<Animator>();
			hud = FindObjectOfType<HudController>();
			OnReaction += hud.PostReaction;
			animator.SetTrigger("start");
		}