Example #1
0
		void Start ()
		{
			_characterCollider = GetComponent<CircleCollider2D> ();
			character = GetComponent<Character>();
			audioPlayer = transform.root.GetComponent<AudioPlayerCharacter>();
			disgusted = maxDisgusted;
		}
Example #2
0
		// Use this for initialization
		void Start () {
			

			if (audiosource == null) {

					audiosource = transform.GetOrAddComponent<AudioSource>();
			}
				

			// get sounds of material
			var worldSounds = FindObjectOfType<WorldSounds>();

			if (worldSounds == null) {
				print (" no world sound bank");
				return;
			}

			if (transform.gameObject.CompareTag(Tags.Character)){
				isPlayer = true;
				audioPlayerCharacter = transform.root.GetComponent<AudioPlayerCharacter>();
			}

			switch (material)
			{
			case materialTypes.Wood:
				audioHitA = worldSounds.woodHitsA;
				audioHitB = worldSounds.woodHitsB;
				audioHitC = worldSounds.woodHitsC;
				audioHitD = worldSounds.woodHitsD;
				break;
			case materialTypes.MetalBall:
				audioHitA = worldSounds.metalBallHitsA;
				audioHitB = worldSounds.metalBallHitsB;
				audioHitC = worldSounds.metalBallHitsC;
				audioHitD = worldSounds.metalBallHitsD;
				audioRoll = worldSounds.metalBallRoll;
				isRollable = true;
				break;
			case materialTypes.Body:
				audioHitA = worldSounds.bodyHitsA;
				audioHitB = worldSounds.bodyHitsB;
				audioHitC = worldSounds.bodyHitsC;
				audioHitD = worldSounds.bodyHitsD;
				break;
			}

			isInitialized = true;
		}
Example #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();

		}
Example #4
0
		// Use this for initialization
		public void Init (string[] primaryWeapons = null) {
			
			Physics2D.IgnoreCollision (headCollider , bodyCollider);

			if (transform.parent.gameObject.CompareTag(Tags.GameController)) {
				gameController = transform.parent.gameObject;
				playerObjects = gameController.GetComponent<PlayerObjectReferences>();
				playerObjects.character = this;

				jetPack.Init();
				weaponHolder.GetComponent<WeaponHolder>().Init(primaryWeapons);

				gameController.GetComponent<CharacterCustomizationSync>().RegisterObjectsToColor(playerColorObjects);
				combat = gameController.GetComponent<Combat>();
				StatusIndicators statusIndicators = transform.parent.GetComponentInChildren<StatusIndicators>();
				if (statusIndicators != null) {
					statusIndicators.Init();
				}

				audioPlayer = transform.root.GetComponent<AudioPlayerCharacter>();
				deliveryPointInitialLocalPosition = deliveryPoint.transform.localPosition;

				bodyColor = playerColorObjects[0].GetComponent<SpriteRenderer>().color;
			}

		}
Example #5
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;
            }
        }
Example #6
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;

		}
Example #7
0
		// Use this for initialization
		public void Init ()
		{
			_networkController = FindObjectOfType<PlayersManager> ();
			audioPlayer = GetComponent<AudioPlayerCharacter> ();
			initialized = true;
		}