Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        //Check that this is owned by player
        if (hasAuthority == false)
        {
            return;
        }

        //Toggle cursor activation
        if (Input.GetKeyDown(KeyCode.LeftAlt))
        {
            if (isCursorEnabled)
            {
                DisableCursor();
                canMove = true;
            }
            else
            {
                EnableCursor();
                canMove = false;
            }
        }

        //Activate flash light
        if (Input.GetKeyDown(KeyCode.F))
        {
            flashLight.ToggleFlashLight(!flashLight.GetFlashLightStatus());
        }

        //Movement
        Move();
        Rotate();
        Jump();
    }
    void RpcUpdateFlashLightStatus(bool status)
    {
        PlayerFlashLight flashlight = playerGameObject.GetComponent <PlayerFlashLight>();

        if (flashlight != null)
        {
            flashlight.ToggleFlashLight(status);
        }
    }