Beispiel #1
0
 // Update is called once per frame
 void Update()
 {
     if (mPlayerInput.Shoot())
     {
         EnemySpawnManager.getInstance().killAllInvisibleEnemies();
     }
 }
Beispiel #2
0
    void Update()
    {
        if (!playerController.canControl)
        {
            return;
        }

        switch (playerInput.UseMobileInput)
        {
        case true:
            InputX = playerInput.LookInput().x + playerInput.ShotInput().x;
            InputY = playerInput.LookInput().y + playerInput.ShotInput().y;
            break;

        case false:
            InputX = Input.GetAxis("Mouse X") * 10;
            InputY = Input.GetAxis("Mouse Y") * 10;
            break;
        }

        sensitivity = playerInput.Shoot() ? ShootSensitivity : LookSensitivity;

        PlayerHead.localPosition = Vector3.Lerp(PlayerHead.localPosition, new Vector3(
                                                    PlayerHead.localPosition.x, playerController.controller.center.y + playerController.controller.height / 2 - 0.25F, PlayerHead.localPosition.z), 0.15F * 3);

        lookAt.x = Mathf.Lerp(lookAt.x, InputX, Smooth * Time.deltaTime);
        lookAt.y = Mathf.Lerp(lookAt.y, InputY, Smooth * Time.deltaTime);

        transform.Rotate(0.0F, lookAt.x * (sensitivity / 10), 0.0F);
        rotationY += lookAt.y * (sensitivity / 10);
        rotationY  = Mathf.Clamp(rotationY, minimumY, maximumY);
        PlayerHead.localEulerAngles = new Vector3(-rotationY, PlayerHead.localEulerAngles.y, 0.0F);
    }
    void Update()
    {
        if (playerInput.Shoot())                         //IF SHOOT BUTTON IS PRESSED (Replace your mouse input)
        {
            if (Time.time > delay)
            {
                Shoot();
            }
        }

        if (playerInput.Reload())                        //IF RELOAD BUTTON WAS PRESSED (Replace your keyboard input)
        {
            if (!reloading && ammoCount < ammo)
            {
                StartCoroutine("Reload");
            }
        }
    }