// Start is called before the first frame update void Start() { avatar = GetComponent <PlayerAvatar>(); //Si es el jugador local //if(GameManager.isLocalGame || GameManager.isHost) androidInputs = FindObjectOfType <AndroidInputs>(); networkPlayer = GetComponent <NetworkPlayer>(); gameUIManager = FindObjectOfType <GameUIManager>(); gemPool = FindObjectOfType <GemPool>(); audioSource = FindObjectOfType <PersistentAudioSource>(); if (!PlayerSpawnerManager.isInHub) { gameUIManager.ActivatePlayerUI(playerNumber, userInfo.id); } rb = gameObject.GetComponent <Rigidbody>(); horizontalSpeed = startingHorizontalSpeed; verticalSpeed = startingVerticalSpeed; maxHorizontalSpeed = startingMaxHorizontalSpeed; maxVerticalSpeed = startingMaxVerticalSpeed; currentTier = gemPouchTiers[0]; ChangePouchSize(); if (!GameManager.isLocalGame) { if (GameManager.isHost) { animator.runtimeAnimatorController = hostAnimator; } else if (GameManager.isClient) { animator.runtimeAnimatorController = clientAnimator; } } groundMeshOrientation = playerMesh.transform.right; }
public void AddScore(int score) { this.score += score; if (!GameManager.isLocalGame) { if (GameManager.isHost) { //Manda input por red networkPlayer.info.sc = score; } } if (!PlayerSpawnerManager.isInHub) { if (!GameManager.isLocalGame) { if (gameUIManager == null) { gameUIManager = FindObjectOfType <GameUIManager>(); if (gameUIManager != null) { gameUIManager.ActivatePlayerUI(playerNumber, userInfo.id); gameUIManager.UpdatePlayerUI(playerNumber, this.score, userInfo.id); } } else { gameUIManager.UpdatePlayerUI(playerNumber, this.score, userInfo.id); } } else { if (GameManager.english) { gameUIManager.UpdatePlayerUI(playerNumber, this.score, "P"); } else { gameUIManager.UpdatePlayerUI(playerNumber, this.score, "J"); } } } }
void Update() { if (!PlayerSpawnerManager.isInHub && gameUIManager == null) { gameUIManager = FindObjectOfType <GameUIManager>(); if (gameUIManager != null) { if (!GameManager.isLocalGame) { gameUIManager.ActivatePlayerUI(playerNumber, userInfo.id); } else { if (GameManager.english) { gameUIManager.ActivatePlayerUI(playerNumber, "P"); } else { gameUIManager.ActivatePlayerUI(playerNumber, "J"); } } } } //Mobile MobileInputs(); //PC //Máquina del host, pero jugadores clientes if (!GameManager.isLocalGame) { if (GameManager.isHost && userInfo.isClient) { //Recibir input por red joystick = networkPlayer.inputInfo.joystick; throwGemInput = networkPlayer.inputInfo.throwGemInput; animator.speed = networkPlayer.info.s; ThrowGem(); } else if (GameManager.isClient && networkPlayer.info != null) { animator.speed = networkPlayer.info.s; score = networkPlayer.info.sc; if (gameUIManager == null) { gameUIManager = FindObjectOfType <GameUIManager>(); if (gameUIManager != null) { gameUIManager.UpdatePlayerUI(playerNumber, this.score, userInfo.id); } } else { gameUIManager.UpdatePlayerUI(playerNumber, this.score, userInfo.id); } currentPouchSize = networkPlayer.info.g; ChangePouchSize(); playerMesh.transform.rotation = Quaternion.Euler(networkPlayer.info.rx * 0.01f, networkPlayer.info.ry * 0.01f, networkPlayer.info.rz * 0.01f); } } }