Exemplo n.º 1
0
		// Use this for initialization
		void Start () {
			headCollider = GetComponent<Collider2D>();
			var playerObj = transform.root.GetComponent<PlayerObjectReferences>();
			if (playerObj != null) {
				character = playerObj.character;
			}
		}
Exemplo n.º 2
0
		void Start ()
		{
			_characterCollider = GetComponent<CircleCollider2D> ();
			character = GetComponent<Character>();
			audioPlayer = transform.root.GetComponent<AudioPlayerCharacter>();
			disgusted = maxDisgusted;
		}
Exemplo n.º 3
0
        public void Init(Character character)
        {
            if (!base.isLocalPlayer) {

                Rigidbody2D rb = character.GetComponent<Rigidbody2D> ();
                rb.isKinematic = true;

            }
        }
Exemplo n.º 4
0
		// Use this for initialization
		void Start () {
			character = GetComponentInParent<Character>();

			if (character == null)
				return;

			if (objectsToColor.Length == 0)
				GetComponent<SpriteRenderer>().color = character.skinColor;

			foreach (SpriteRenderer s in objectsToColor) {
				s.color = character.skinColor;
			}

		}
Exemplo n.º 5
0
		public void AnitmateRespawn ()
		{

			if (character == null) {
				character = GetComponent<Character>();
			}

			ToggleDummyHead (false);


			character.animator.SetBool("isDead" , false);

			damageByShock = 0;
			isDead = false;
			isParalyzed = false;
			disgusted = maxDisgusted;
		}
Exemplo n.º 6
0
		public Character LoadCharacter (string name , string[] primaryWeapons = null) {
			

				if (character != null) 
					Destroy ( character.gameObject);

				character = GameObject.Instantiate ( charactersPref.FirstOrDefault ( c => c.GetComponent<Character>().characterID == name ) ).GetComponent<Character>();
				character.gameObject.transform.SetParent (this.gameObject.transform , false);

				currentCharacterID = character.characterID;
				characterNetworkTransform.target = character.gameObject.transform;
				weaponHolderNetworkTransform.target = character.weaponHolder.transform;

				character.Init(primaryWeapons);


			return character;
		}
Exemplo n.º 7
0
        // Use this for initialization
        public void Init()
        {
            character = transform.root.GetComponent<PlayerObjectReferences>().character;
            if (character == null) {
                Debug.Log("f**k, character is null");
                return;
            }
            characterRB = character.gameObject.GetComponent<Rigidbody2D> ();
            characterAnimator = character.animator;
            characterCollider = character.bodyCollider;
            punchingHand = character.punchingHand;
            meleeEffect = character.meleeEffect;
            weaponHolder = character.weaponHolder;
            audioPlayerCharacter = GetComponent<AudioPlayerCharacter>();

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

                ID = multiplayerPlayerController.ID;
                _isLocalPlayer = multiplayerPlayerController.isLocalPlayer;
            }
        }
Exemplo n.º 8
0
		// Use this for initialization

		public void Init ()
		{

			isOffline = FindObjectOfType<PlayersManager> ().isOffline;
			globalSounds = FindObjectOfType<GlobalSounds> ().GetComponent<GlobalSounds> ();
			if (isOffline) {
				// Offline
				ID = GetComponent<OfflinePlayerController> ().ID;
			} else {
				// Online
				audioNetworking = GetComponent<AudioNetworking> ();
				audioNetworking.Init();
				ID = GetComponent<MultiplayerPlayerController> ().ID;
			}
			StartCoroutine (PlayJoinSound ());
			playerObjects = GetComponent<PlayerObjectReferences>();
			character = playerObjects.character;

			characterVoiceAudioSource = character.voiceAudioSource;
			meleeAudioSource = character.meleeAttackAudioSource;
			weaponHolderAudioSource = character.weaponHolderAudioSource;
		}
Exemplo n.º 9
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.º 10
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.º 11
0
		// Use this for initialization
		void Start () {
			character = GetComponentInParent<Character>();
		}
Exemplo n.º 12
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;

		}