예제 #1
0
    void FixedUpdate()
    {
        movement = new Vector3(-Input.GetAxis("Vertical"), 0, Input.GetAxis("Horizontal")) * speed * (Input.GetKey(KeyCode.LeftShift) ? multiplier : 1);
        gameObject.transform.Translate(movement);

        direction          = new Vector3(0, Input.GetAxis("Mouse X"), 0f) * rotationSpeed;
        transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles + direction);

        if (IsRuning())
        {
            sliderScript.IncreaseDetection(0.5f);
            if (!isRunningSound)
            {
                isRunningSound   = true;
                audioSource.loop = true;
                PlaySound(run, true);
            }
        }
        if (isRunningSound && !IsRuning())
        {
            isRunningSound = false;
            audioSource.Stop();
        }
        if (hints.color.a > 0)
        {
            color.a    -= 0.005f;
            hints.color = color;
        }
    }
예제 #2
0
 private void OnTriggerStay(Collider other)
 {
     sliderScript.IncreaseDetection(detectionZoneValue);
     sliderScript.isIncreased = true;
 }