예제 #1
0
		IEnumerator DelayedInit ()
		{
			yield return new WaitForSeconds (0.2f);
			moveJoystick.Init ();
			aimJoystick.Init ();
	
			moveJoystick.OnMove += UpdateMovement;
			aimJoystick.OnAim += UpdateAim;
			aimJoystick.OnMelee += DoMelee;
	
			var inputManagers = FindObjectsOfType<InputManager> ();
			inputManager = inputManagers.FirstOrDefault (j => j._isLocalPlayer);
	
			var weaponHolders = FindObjectsOfType<WeaponHolder> ();
			weaponHolder = weaponHolders.FirstOrDefault (w => w.GetId() == inputManager.ID);
	
			var statusIndicatorses = FindObjectsOfType<StatusIndicators> ();
			statusIndicators = statusIndicatorses.FirstOrDefault (s => s.transform.GetComponentInParent<NetworkIdentity> ().isLocalPlayer);
	
			animator = GetComponent<Animator> ();
			if (showTutorial)
				animator.SetTrigger ("StartTutorial");
			
			initialized = true;
	
		}
예제 #2
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);
			}
		}
예제 #3
0
        // Use this for initialization
        void Start()
        {
            //find childs
            gameController = this.gameObject;

            foreach (Transform child in transform) {

                if (child.gameObject.name == "Character") {
                    character = child.gameObject;

                    foreach (Transform child2 in character.transform) {
                        if (child2.gameObject.name == "weaponHolder") {
                            weaponHolder = child2.gameObject;
                            _weaponHolderController = weaponHolder.GetComponent<WeaponHolder> ();
                        }
                    }
                }
                if (child.gameObject.name == "Player Input") {
                    _inputManager = child.gameObject.GetComponent<InputManager> ();
                }
            }
            //get Hud Components
            foreach (Transform child in gameObject.transform) {
                if (child.gameObject.name == "HUD") {

                    foreach (Transform grandchild in child.gameObject.transform) {
                        if (grandchild.gameObject.name == "Edge Indicators") {
                            ui_edgeIndicator = grandchild.gameObject;
                        }
                    }
                }
            }
            // get components
            gameController.GetComponent<OfflinePlayerController> ();
            RegisterPlayer (); // set name of game controller
        }
예제 #4
0
파일: JetPack.cs 프로젝트: Kundara/project1
		// Use this to initiate universe reboot
		public void Init ()
		{
			rigidBody = GetComponent<Rigidbody2D> ();
			_characterAnimator = GetComponent<Animator> ();

			if (transform.root.CompareTag(Tags.GameController)){
				
				_isLocal = transform.parent.GetComponent<MultiplayerPlayerController> ().isLocalPlayer;
			} else {
				_isLocal = true;
			}


			var character = GetComponentInParent<Character>();

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


			SetKinematicForNonLocal();
			
			initialized = true;
		}
예제 #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;
            }
        }
예제 #6
0
		// initialization
		public void init (string playerId , Transform characterTransform)
		{
			if (_initiated)
				return;

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

			if (!_isOffline) {
				// Online
				_twirl = GetComponent<Twirl> ();

				var combats = FindObjectsOfType<Combat> ();
				_combat = combats.FirstOrDefault (c => c.isLocalPlayer);

				var weaponHolderControllers = FindObjectsOfType<WeaponHolder> ();
				_weaponHolder = weaponHolderControllers.FirstOrDefault (w => w.transform.GetComponentInParent<Combat> ().isLocalPlayer);

				_character = characterTransform;

				_cam = GetComponent<Camera> ();
				//minZDist = _cam.transform.position.z;

			} else {
				// Offline
				_startPosition = transform.position;
			}

			bloom = GetComponent<Bloom>();

			_initiated = true; 
		}
예제 #7
0
파일: Weapon.cs 프로젝트: Kundara/project1
		//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;

		}
예제 #8
0
파일: Shocker.cs 프로젝트: Kundara/project1
 // Use this for initialization
 void Start()
 {
     weaponHolder = GetComponentInParent<WeaponHolder>();
     // if online....
     _combatAmmoSync = transform.root.GetComponent<CombatAmmoSync>();
     ID = _combatAmmoSync.ID;
     audioSource = GetComponent<AudioSource>();
 }