Example #1
0
 public void Init(Transform character, Transform camera)
 {
     _currentXRot = camera.transform.localEulerAngles.x;
     _currentYRot = character.localEulerAngles.y;
     _rotationX   = new SmoothRotation(_currentXRot);
     _rotationY   = new SmoothRotation(_currentYRot);
 }
Example #2
0
    void Start()
    {
        _rotationX = new SmoothRotation(RotationXRaw);
        _rotationY = new SmoothRotation(RotationYRaw);

        Cursor.lockState = CursorLockMode.Locked;
        ValidateRotationRestriction();
    }
Example #3
0
 protected virtual void Awake()
 {
     rigidbody = gameObject.GetComponent <Rigidbody>();
     // For now, we assume the set position and rotation is equal to the server one.
     // Default velocities are probably empty, but set them anyway.
     SmoothPosition        = new SmoothVector(gameObject.transform.position);
     SmoothVelocity        = new SmoothVector(rigidbody.velocity);
     SmoothRotation        = new SmoothRotation(gameObject.transform.rotation);
     SmoothAngularVelocity = new SmoothVector(rigidbody.angularVelocity);
 }
Example #4
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;
    }
Example #5
0
    //MovementSetting LookSetting

    // Start is called before the first frame update
    void Start()
    {
        //armのポジションとローテーションをthisと同期?
        arms = AssignCharactersCamera();
        //スタート時のマウス移動格納
        _rotateX = new SmoothRotation(mouseX);
        _rotateY = new SmoothRotation(mouseY);

        _rigidbody = GetComponent <Rigidbody>();

        LifeGuage = _Life.fillAmount;
    }
Example #6
0
 private void Start()
 {
     cam              = GameObject.Find("Main Camera").transform;
     world            = GameObject.Find("World").GetComponent <World>();
     audioSource      = GetComponent <AudioSource>();
     arms             = AssignCharactersCamera();
     audioSource.clip = walkingSound;
     audioSource.loop = true;
     _rotationX       = new SmoothRotation(mouseHorizontal * lookSensitivity);
     _rotationY       = new SmoothRotation(mouseHorizontal * lookSensitivity);
     Cursor.lockState = CursorLockMode.Locked;
     ValidateRotationRestriction();
 }
Example #7
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);
 }
Example #8
0
File: Doors.cs Project: Pastew/room
    protected override void InvokeAction()
    {
        SmoothRotation smoothRotation = gameObject.AddComponent <SmoothRotation>();

        if (closed)
        {
            smoothRotation.Setup(startRotation, endRotation, openingRotationSpeed);
        }
        else
        {
            smoothRotation.Setup(endRotation, startRotation, closingRotationSpeed);
        }

        closed = !closed;
    }
Example #9
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();
 }
    private void DieByDefault(Vector3 direction, Boolean needToDestroy)
    {
        var smoothRotation = new SmoothRotation(gameObject)
        {
            Distance  = -90,
            Direction = direction,
            Speed     = 30f
        };

        if (needToDestroy)
        {
            smoothRotation.AddPostAction(g => CmdDestroy(gameObject));
        }
        StartCoroutine(smoothRotation.MakeItSmooth());
    }
Example #11
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();
        }
Example #12
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();
 }
Example #13
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();
        }
 /// 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;
 }
Example #16
0
    internal void Rotate(int direction)
    {
        Quaternion startRotation = transform.localRotation;

        Vector3    eulerRotation = new Vector3(0, 0, 36 * direction);
        Quaternion endRotation   = Quaternion.Euler(startRotation.eulerAngles + eulerRotation);

        SmoothRotation smoothRotation = gameObject.AddComponent <SmoothRotation>();

        smoothRotation.Setup(startRotation, endRotation, rotationSpeed, methodToCallOnRotationFinished);
        value -= direction; // There is minus, because rotating left increases the value

        if (value == -1)
        {
            value = 9;
        }

        if (value == 10)
        {
            value = 0;
        }
    }
Example #17
0
        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();
        }
        /// 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;
        }
Example #19
0
 private void Awake()
 {
     position = new SmoothPosition(this);
     rotation = new SmoothRotation(this);
 }