Exemplo n.º 1
0
    private void Start()
    {
        activeWeaponIndex   = -1;
        m_WeaponSwitchState = WeaponSwitchState.Down;

        m_InputHandler = GetComponent <PlayerInputHandler_Photon>();
        playerWapMan   = GetComponent <PlayerWeaponsManager_Photon>();
        DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler_Photon, PlayerWeaponsManager_Photon>(m_InputHandler, this, gameObject);

        m_PlayerCharacterController = GetComponent <PlayerCharacterController_Photon>();
        DebugUtility.HandleErrorIfNullGetComponent <PlayerCharacterController_Photon, PlayerWeaponsManager_Photon>(m_PlayerCharacterController, this, gameObject);

        SetFOV(defaultFOV);

        onSwitchedToWeapon += OnWeaponSwitched;

        // Add starting weapons
        foreach (var weapon in startingWeapons)
        {
            AddWeapon(weapon);
        }
        SwitchWeapon(true);

        weaponParentSocket.transform.parent = weaponCamera.transform;
    }
Exemplo n.º 2
0
    void Start()
    {
        controller = GetComponent <PlayerCharacterController_Photon>();
        if (!gameObject.GetComponent <PhotonView>().ObservedComponents.Contains(this))
        {
            gameObject.GetComponent <PhotonView>().ObservedComponents.Add(this);
        }

        gameObject.GetComponent <PhotonView>().Synchronization = ViewSynchronization.Unreliable;

        GetValues();

        if (photonView.IsMine)
        {
            controller.canControl         = false;
            controller.externalController = true;
            //	characterPrefab.SetActive(false);
        }
        else
        {
            controller.canControl         = true;
            controller.externalController = false;
            //	characterPrefab.SetActive(true);
        }
        gameObject.name = gameObject.name + photonView.ViewID;

        //		PhotonNetwork.SendRate = 60;
        //		PhotonNetwork.SerializationRate = 60;
    }
Exemplo n.º 3
0
    private void Awake()
    {
        m_PlayerController_Photon = FindObjectOfType <PlayerCharacterController_Photon>();
        //  DebugUtility.HandleErrorIfNullFindObject<PlayerCharacterController_Photon, EnemyManager>(m_PlayerController_Photon, this);

        enemies = new List <EnemyController_Photon>();
    }
Exemplo n.º 4
0
    private void OnTriggerEnter(Collider other)
    {
        if (Online)
        {
            PlayerCharacterController_Photon pickingPlayer_Photon = other.GetComponent <PlayerCharacterController_Photon>();

            if (pickingPlayer_Photon != null)
            {
                if (onPick_Photon != null)
                {
                    onPick_Photon.Invoke(pickingPlayer_Photon);
                    PickUP = true;
                }
            }
        }
        else
        {
            PlayerCharacterController pickingPlayer = other.GetComponent <PlayerCharacterController>();

            if (pickingPlayer != null)
            {
                if (onPick != null)
                {
                    onPick.Invoke(pickingPlayer);
                    PickUP = true;
                }
            }
        }
    }
Exemplo n.º 5
0
    private void LateUpdate()
    {
        m_PlayerCharacterController = GetComponent <PlayerCharacterController_Photon>();
        DebugUtility.HandleErrorIfNullGetComponent <PlayerCharacterController_Photon, PlayerInputHandler_Photon>(m_PlayerCharacterController, this, gameObject);
        m_GameFlowManager = FindObjectOfType <GameFlowManager_Photon>();
        DebugUtility.HandleErrorIfNullFindObject <GameFlowManager_Photon, PlayerInputHandler_Photon>(m_GameFlowManager, this);


        m_FireInputWasHeld = GetFireInputHeld();
    }
Exemplo n.º 6
0
    private void Start()
    {
        m_PlayerCharacterController = GetComponent <PlayerCharacterController_Photon>();
        DebugUtility.HandleErrorIfNullGetComponent <PlayerCharacterController_Photon, PlayerInputHandler_Photon>(m_PlayerCharacterController, this, gameObject);
        m_GameFlowManager = FindObjectOfType <GameFlowManager_Photon>();
        DebugUtility.HandleErrorIfNullFindObject <GameFlowManager_Photon, PlayerInputHandler_Photon>(m_GameFlowManager, this);

        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible   = false;
    }
Exemplo n.º 7
0
    void Start()
    {
        isJetpackUnlocked = isJetpackUnlockedAtStart;

        m_PlayerCharacterController = GetComponent <PlayerCharacterController_Photon>();
        m_InputHandler = GetComponent <PlayerInputHandler_Photon>();
        splayersync    = GetComponent <PlayerSync>();

        currentFillRatio = 1f;

        audioSource.clip = jetpackSFX;
        audioSource.loop = true;
    }
Exemplo n.º 8
0
    void OnPickedOnline(PlayerCharacterController_Photon byPlayer)
    {
        var jetpack = byPlayer.GetComponent <JetPack_Photon>();

        if (!jetpack)
        {
            return;
        }

        if (jetpack.TryUnlock())
        {
            m_Pickup.PlayPickupFeedback();

            Destroy(gameObject);
        }
    }
    public void sapwPlayer()
    {
        //  GameObject m_Player = PhotonNetwork.Instantiate(this.playerPrefab.name, new Vector3(0f, 5f, 0f), Quaternion.identity, 0).GetComponent<PlayerCharacterController_Photon>();

        m_Player = PhotonNetwork.Instantiate("Photon Resources/Player/" + playerPrefab.gameObject.name, spawnPoint.position + (Vector3.up), spawnPoint.rotation, 0).GetComponent <PlayerCharacterController_Photon>();



        DebugUtility.HandleErrorIfNullFindObject <PlayerCharacterController_Photon, GameFlowManager_Photon>(m_Player, this);

        m_ObjectiveManager = FindObjectOfType <ObjectiveManager>();
        DebugUtility.HandleErrorIfNullFindObject <ObjectiveManager, GameFlowManager_Photon>(m_ObjectiveManager, this);

        m_Player.playerCamera = playerCamera;
        m_Player.weaponCamera = weaponCamera;

        InGameUi.SetActive(true);
        objectActiveOnSapwn.SetActive(true);
    }
Exemplo n.º 10
0
    private void Start()
    {
        if (online)
        {
            PlayerCharacterController_Photon character = FindObjectOfType <PlayerCharacterController_Photon>();
            DebugUtility.HandleErrorIfNullFindObject <PlayerCharacterController_Photon, StanceHUD>(character, this);
            character.onStanceChanged += OnStanceChanged;

            OnStanceChanged(character.isCrouching);
        }
        else
        {
            PlayerCharacterController character = FindObjectOfType <PlayerCharacterController>();
            DebugUtility.HandleErrorIfNullFindObject <PlayerCharacterController, StanceHUD>(character, this);
            character.onStanceChanged += OnStanceChanged;

            OnStanceChanged(character.isCrouching);
        }
    }