private void Initialise() { playerCam.Initialise(IsConnectedAndMine()); playerController.Initialise(IsConnectedAndMine()); weaponChargeCanvas.Initialise(IsConnectedAndMine()); dwarfAnimEvents.Initialise(IsConnectedAndMine()); dwarfAnimController.Initialise(IsConnectedAndMine()); rangedWeaponLookAt.Initialise(IsConnectedAndMine()); myInventory.Initialise(IsConnectedAndMine()); weaponSlot.Initialise(IsConnectedAndMine()); helmetSlot.Initialise(IsConnectedAndMine()); trinketSlot.Initialise(IsConnectedAndMine()); playerUICam.SetActive(IsConnectedAndMine() ? true : false); characterCam.SetActive(IsConnectedAndMine() ? true : false); Destroy(IsConnectedAndMine() ? null : rb); if (PhotonNetwork.IsConnected) { CreateWorldSpacePlayerUI(); } if (!IsConnectedAndMine()) { CreateScreenSpacePlayerUI(entity); SetLayer(transform, 14); foreach (Collider col in GetComponentsInChildren <Collider>()) { if (!col.GetComponent <Entity>()) { col.enabled = false; } } } else { playerAppearance.RandomizeAppearance(); playerController.OnDodge += PlayerController_OnDodge; entity.OnDeath.AddListener(() => Entity_OnDeath()); entity.OnHit.AddListener(() => cameraShake.Trauma = 0.5f); DontDestroyOnLoad(gameObject); } }
private void Initialise() { playerCamera.SetActive(IsConnectedAndMine() ? true : false); hitInfoDetectionCol.SetActive(IsConnectedAndMine() ? false : true); playerController.Inititalise(IsConnectedAndMine()); weaponSlot.Initialise(IsConnectedAndMine()); playerAnimController.Initialise(IsConnectedAndMine()); playerInteractionController.Initialise(IsConnectedAndMine()); if (IsConnectedAndMine()) { //entity.GetComponent<Collider>().enabled = false; GameManager.OnGameStateChanged += GameManager_OnGameStateChanged; DontDestroyOnLoad(gameObject); } }