예제 #1
0
    private void Start()
    {
        groundCheckRadius = capsuleCollider.radius;

        rotationX = new SmoothRotation(zero);
        rotationY = new SmoothRotation(zero);
        velocityX = new SmoothVelocity();
        velocityZ = new SmoothVelocity();

        Cursor.visible   = hided;
        Cursor.lockState = CursorLockMode.Locked;
    }
예제 #2
0
 // Start is called before the first frame update
 void Start()
 {
     _collider        = GetComponent <CapsuleCollider>();
     _rigidbody       = GetComponent <Rigidbody>();
     arm              = AssignCharactersCamera();
     _rotation_X      = new SmoothRotation(Input.GetAxisRaw("Mouse X") * mouseSensitivity);
     _rotation_Y      = new SmoothRotation(Input.GetAxisRaw("Mouse Y") * mouseSensitivity);
     _velocity_X      = new SmoothVelocity();
     _velocity_Z      = new SmoothVelocity();
     Cursor.lockState = CursorLockMode.Locked;
     ValidateRotationRestriction();
     //transform.rotation = transform.rotation * Quaternion.Euler(0, 30, 0);
 }
예제 #3
0
 // Start is called before the first frame update
 void Start()
 {
     _rigidbody             = GetComponent <Rigidbody>();
     _rigidbody.constraints = RigidbodyConstraints.FreezeRotation;
     _collider         = GetComponent <CapsuleCollider>();
     _audioSource      = GetComponent <AudioSource>();
     _audioSource.clip = walkingSound;
     _audioSource.loop = true;
     _rotationX        = new SmoothRotation(RotationXRaw);
     _rotationY        = new SmoothRotation(RotationYRaw);
     _velocityX        = new SmoothVelocity();
     _velocityZ        = new SmoothVelocity();
     Cursor.lockState  = CursorLockMode.Locked;
     //ValidateRotationRestriction();
 }
예제 #4
0
        /// Initializes the FpsController on start.
        private void Start()
        {
            joyStick = GetComponentInChildren <JoyStick>();

            _rigidbody             = GetComponent <Rigidbody>();
            _rigidbody.constraints = RigidbodyConstraints.FreezeRotation;
            _collider         = GetComponent <CapsuleCollider>();
            _audioSource      = GetComponent <AudioSource>();
            arms              = AssignCharactersCamera();
            _audioSource.clip = walkingSound;
            _audioSource.loop = true;
            _rotationX        = new SmoothRotation(RotationXRaw);
            _rotationY        = new SmoothRotation(RotationYRaw);
            _velocityX        = new SmoothVelocity();
            _velocityZ        = new SmoothVelocity();
            Cursor.lockState  = CursorLockMode.Locked;
            ValidateRotationRestriction();
        }
예제 #5
0
 /// Initializes the FpsController on start.
 private void Start()
 {
     FlashLight             = GameObject.Find("FlashLight");
     _rigidbody             = GetComponent <Rigidbody>();
     _rigidbody.constraints = RigidbodyConstraints.FreezeRotation;
     _collider         = GetComponent <CapsuleCollider>();
     _audioSource      = GetComponent <AudioSource>();
     arms              = AssignCharactersCamera();
     _audioSource.clip = walkingSound;
     _audioSource.loop = true;
     _rotationX        = new SmoothRotation(RotationXRaw);
     _rotationY        = new SmoothRotation(RotationYRaw);
     _velocityX        = new SmoothVelocity();
     _velocityZ        = new SmoothVelocity();
     Cursor.lockState  = CursorLockMode.Locked;
     Cursor.visible    = false;
     ValidateRotationRestriction();
 }
예제 #6
0
        /// Initializes the FpsController on start.
        private void Start()
        {
            standColliderSettings = new CrouchColliderSettings(capsuleCollider.height, capsuleCollider.center);
            //localArmsPosStand = crouchHolder.localPosition;

            _rigidbody             = GetComponent <Rigidbody>();
            _rigidbody.constraints = RigidbodyConstraints.FreezeRotation;
            _collider         = GetComponent <CapsuleCollider>();
            _audioSource      = GetComponent <AudioSource>();
            arms              = AssignCharactersCamera();
            _audioSource.clip = walkingSound;
            _audioSource.loop = true;
            _rotationX        = new SmoothRotation(RotationXRaw);
            _rotationY        = new SmoothRotation(RotationYRaw);
            _velocityX        = new SmoothVelocity();
            _velocityZ        = new SmoothVelocity();
            Cursor.lockState  = CursorLockMode.Locked;
            ValidateRotationRestriction();
        }
        /// Initializes the FpsController on start.
        private void Start()
        {
            slide     = sensSlider.GetComponent <UnityEngine.UI.Slider>();
            pauseMenu = GameObject.Find("Tutorial").GetComponent <PauseMenu>();

            _rigidbody             = GetComponent <Rigidbody>();
            _rigidbody.constraints = RigidbodyConstraints.FreezeRotation;
            _collider         = GetComponent <CapsuleCollider>();
            _audioSource      = GetComponent <AudioSource>();
            arms              = AssignCharactersCamera();
            _audioSource.clip = walkingSound;
            _audioSource.loop = true;
            _rotationX        = new SmoothRotation(RotationXRaw);
            _rotationY        = new SmoothRotation(RotationYRaw);
            _velocityX        = new SmoothVelocity();
            _velocityZ        = new SmoothVelocity();

            ValidateRotationRestriction();
        }
예제 #8
0
 /// Initializes the FpsController on start.
 private void Awake()
 {
     _rigidbody             = GetComponent <Rigidbody>();
     _rigidbody.constraints = RigidbodyConstraints.FreezeRotation;
     _collider         = GetComponent <CapsuleCollider>();
     _audioSource      = GetComponent <AudioSource>();
     arms              = AssignCharactersCamera();
     _audioSource.clip = walkingSound;
     _audioSource.loop = true;
     _rotationX        = new SmoothRotation(RotationXRaw);
     _rotationY        = new SmoothRotation(RotationYRaw);
     _velocityX        = new SmoothVelocity();
     _velocityZ        = new SmoothVelocity();
     Cursor.lockState  = CursorLockMode.Locked;
     ValidateRotationRestriction();
     standartHeight           = _collider.height;
     standartColliderPosition = _collider.center;
     tfFirstWeapon            = firstWeapon.transform;
     tfSecondaryWeapon        = secondaryWeapon.transform;
 }
예제 #9
0
파일: Player.cs 프로젝트: H2SU/Project-FPS
        private void Start()
        {
            if (entity.IsOwner)
            {
                NM.myPlayer = this.entity;
            }

            state.nickname         = TitleLobbyManager.TLM.myNickname;
            _rigidbody             = GetComponent <Rigidbody>();
            _rigidbody.constraints = RigidbodyConstraints.FreezeRotation;
            _collider         = GetComponent <CapsuleCollider>();
            _audioSource      = GetComponent <AudioSource>();
            arms              = AssignCharactersCamera();
            _audioSource.clip = walkingSound;
            _audioSource.loop = true;
            _rotationX        = new SmoothRotation(RotationXRaw);
            _rotationY        = new SmoothRotation(RotationYRaw);
            _velocityX        = new SmoothVelocity();
            _velocityZ        = new SmoothVelocity();
            Cursor.lockState  = CursorLockMode.Locked;
            ValidateRotationRestriction();
        }
예제 #10
0
        /// Initializes the FpsController on start.
        private void Start()
        {
            _rigidbody             = GetComponent <Rigidbody>();
            _rigidbody.constraints = RigidbodyConstraints.FreezeRotation;
            _collider         = GetComponent <CapsuleCollider>();
            _audioSource      = GetComponent <AudioSource>();
            arms              = AssignCharactersCamera();
            _audioSource.clip = walkingSound;
            _audioSource.loop = true;
            _rotationX        = new SmoothRotation(RotationXRaw);
            _rotationY        = new SmoothRotation(RotationYRaw);
            _velocityX        = new SmoothVelocity();
            _velocityZ        = new SmoothVelocity();
            Cursor.lockState  = CursorLockMode.Locked;
            ValidateRotationRestriction();

            //AÑADIDO POR MONCHE
            ComArduino comArdu = GameObject.Find("Com").GetComponent <ComArduino>();

            imu_origin.x = comArdu.imu_x;
            imu_origin.y = 0f;
            imu_origin.z = comArdu.imu_y;
        }