Exemplo n.º 1
0
        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);
            }
        }