Exemplo n.º 1
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);
        }
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
		private void GetObjects ()
		{
			_gameController = transform.root.gameObject;
			// finding game controller
			PlayerObjectReferences playerObjects = _gameController.GetComponent<PlayerObjectReferences>();

			_jetPackController = playerObjects.character.jetPack;
			_meleeAttack = _gameController.GetComponent<MeleeAttack> ();
			character = playerObjects.character.gameObject;
			_weaponHolderController = playerObjects.character.weaponHolder.GetComponent<WeaponHolder>();

			_isOffline = GameObject.FindObjectOfType<PlayersManager> ().isOffline;

			if (_isOffline) {
				// Offline
				_OfflinePlayerController = _gameController.GetComponent<OfflinePlayerController> ();
				ID = _OfflinePlayerController.ID;
           
			} else {
				// Online
				_MultiplayerPlayerController = _gameController.GetComponent<MultiplayerPlayerController> ();
				_isLocalPlayer = _MultiplayerPlayerController.isLocalPlayer;
				ID = _MultiplayerPlayerController.ID;
			}
			_scoreBoard = FindObjectOfType<ScorePanelShower> ().GetComponent<ScorePanelShower> ();
			if (!_isOffline || PlayerNum == 1) {
				SetJoystickController (1);
			}
		}
Exemplo n.º 4
0
		//at start
		void GetObjects ()
		{
			_weaponHolder = transform.parent.gameObject.GetComponent<WeaponHolder> ();

			foreach (Transform child in transform) {
				if (child.gameObject.name == "shootFrom") {
					_shootFrom = child.gameObject;
				}
			}

			GameObject gameController = transform.root.gameObject;

			var playerObjectsRef = gameController.GetComponent<PlayerObjectReferences> ();
			character = playerObjectsRef.character;

			_jetPackController = character.jetPack;
			_edgeAnimator = GameObject.FindObjectOfType<edgeIndicator> ().gameObject.GetComponent<Animator> ();

			_characterAnimator = character.animator;

			_isOffline = GameObject.FindObjectOfType<PlayersManager> ().isOffline;
			if (_isOffline) {
				// offline
				_isLocalPlayer = true;
				_OfflinePlayerController = gameController.GetComponent<OfflinePlayerController> ();
				ID = _OfflinePlayerController.ID;
				//_combatOffline = gameController.GetComponent<CombatOffline> ();
			} else {
				// online
				_MultiplayerPlayerController = gameController.GetComponent<MultiplayerPlayerController> ();
				_isLocalPlayer = _MultiplayerPlayerController.isLocalPlayer;
				ID = _MultiplayerPlayerController.ID;
				combat = gameController.GetComponent<Combat> ();
				_CombatAmmoSync = transform.root.gameObject.GetComponent<CombatAmmoSync> ();
			}
			_audioPlayer = gameController.GetComponent<AudioPlayerCharacter> ();
			_cameraCont = GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<CameraController> ();
			_inputManager = playerObjectsRef.inputManager;

			_fire = transform.FindChild ("Fire").GetComponent<ParticleSystem> ();

			if (weaponType == WeaponType.Shocker) {
				shocker = GetComponent<Shocker> ();
				shocker.totalEnergy = damage;
				shocker.range = range;
			}
				

			weaponsHud = FindObjectOfType<WeaponsHud> ();
			statusIndicators = playerObjectsRef.statusIndicators;

		}