Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (InputManager.GetButton(shootButtonName) && breakTime <= 0)
     {
         Fire();
         breakTime = breakBetweenShots;
     }
     breakTime = (breakTime <= 0) ? 0 : breakTime - Time.deltaTime;
 }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (!isLocalPlayer)
        {
            return;
        }
        float hMove = USACPI.GetAxis("Horizontal") * hSpeed;
        float vMove = USACPI.GetAxis("Vertical") * vSpeed;

        transform.Translate(new Vector3(hMove, 0f, vMove));
    }
Exemplo n.º 3
0
    void VerticalRotation()
    {
        float rotationFactor = InputManager.GetAxis(verticalAxisName);

        rotationFactor *= Time.deltaTime * rotationSpeed;

        float angle = (cameraHolder.transform.rotation.eulerAngles.x - rotationFactor) % 360;

        if (IsAngleInRange(angle))
        {
            cameraHolder.transform.Rotate(Vector3.left, rotationFactor, Space.Self);
        }
    }
Exemplo n.º 4
0
        public void RegisterVirtualAxis(CrossPlatformInputManager.VirtualAxis axis)
        {
            // check if we already have an axis with that name and log and error if we do
            if (m_VirtualAxes.ContainsKey(axis.name))
            {
                Debug.LogError("There is already a virtual axis named " + axis.name + " registered.");
                //remove old axis of exist
                m_VirtualAxes[axis.name].Remove();
            }
            // add any new axes
            m_VirtualAxes.Add(axis.name, axis);

            // if we dont want to match with the input manager setting then revert to always using virtual
            if (!axis.matchWithInputManager)
            {
                m_AlwaysUseVirtual.Add(axis.name);
            }
        }
Exemplo n.º 5
0
        public void RegisterVirtualButton(CrossPlatformInputManager.VirtualButton button)
        {
            // check if already have a buttin with that name and log an error if we do
            if (m_VirtualButtons.ContainsKey(button.name))
            {
                Debug.LogError("There is already a virtual button named " + button.name + " registered.");
            }
            else
            {
                // add any new buttons
                m_VirtualButtons.Add(button.name, button);

                // if we dont want to match to the input manager then always use a virtual axis
                if (!button.matchWithInputManager)
                {
                    m_AlwaysUseVirtual.Add(button.name);
                }
            }
        }
Exemplo n.º 6
0
    void Update()
    {
        float rotationH = InputManager.GetAxis("Mouse X");
        float rotationV = InputManager.GetAxis("Mouse Y");

        rotationV         = Mathf.Clamp(-rotationV * RotationSensitivity, -80 - verticalRotation, 80 - verticalRotation);
        verticalRotation += rotationV;

        Camera.main.transform.Rotate(new Vector3(0, rotationH * RotationSensitivity, 0), Space.World);
        Camera.main.transform.Rotate(new Vector3(rotationV, 0, 0));

        float forwardSpeed = InputManager.GetAxis("Vertical");
        float sideWaySpeed = InputManager.GetAxis("Horizontal");

        Vector3 speed = new Vector3(sideWaySpeed, 0, forwardSpeed) * WalkSpeed;

        Camera.main.transform.Translate(speed);

        float elevation = InputManager.GetAxis("Elevation");

        Camera.main.transform.Translate(new Vector3(0, elevation, 0) * WalkSpeed, Space.World);
    }
Exemplo n.º 7
0
 public void SetDownState()
 {
     print("down registered");
     CrossPlatformInputManager.SetButtonDown(Name);
 }
Exemplo n.º 8
0
 void HorizontalRotation()
 {
     transform.Rotate(Vector3.up, Time.deltaTime * rotationSpeed * InputManager.GetAxis(horizontalAxisName));
 }
Exemplo n.º 9
0
 public override void OnPointerDown(PointerEventData data)
 {
     CrossPlatformInputManager.SetButtonDown(ButtonName);
 }
Exemplo n.º 10
0
 public override void OnPointerUp(PointerEventData data)
 {
     CrossPlatformInputManager.SetButtonUp(ButtonName);
     base.OnPointerUp(data);
 }
Exemplo n.º 11
0
 public override void OnEnable()
 {
     base.OnEnable();
     mVirtualButton = new CrossPlatformInputManager.VirtualButton(ButtonName);
     CrossPlatformInputManager.RegisterVirtualButton(mVirtualButton);
 }
Exemplo n.º 12
0
 public void SetAxisNeutralState()
 {
     CrossPlatformInputManager.SetAxisZero(Name);
 }
Exemplo n.º 13
0
 private void Update()
 {
     xAxis = InputManager.GetAxis(xAxisName);
     zAxis = InputManager.GetAxis(zAxisName);
 }
Exemplo n.º 14
0
 public void SetDownState()
 {
     CrossPlatformInputManager.SetButtonDown(Name);
 }
Exemplo n.º 15
0
        CrossPlatformInputManager.VirtualAxis m_VerticalVirtualAxis;   // Reference to the joystick in the cross platform input

        void OnEnable()
        {
            CrossPlatformInputManager.UnRegisterVirtualAxis(verticalAxisName);              // izimenco
            CrossPlatformInputManager.UnRegisterVirtualAxis(horizontalAxisName);            // izimenco
            CreateVirtualAxes();
        }
Exemplo n.º 16
0
 public void SetUpState()
 {
     CrossPlatformInputManager.SetButtonUp(Name);
 }
Exemplo n.º 17
0
        //}


        public void SetUpState()
        {
            CrossPlatformInputManager.SetButtonUp(Name);
            shotButton.color = new Color(1f, 1f, 1f, 0.27f);
        }
Exemplo n.º 18
0
 public void SetAxisPositiveState1()
 {
     CrossPlatformInputManager.SetAxisPositive(Name);
     Invoke("SetAxisNeutralState", 0.2f);
 }
Exemplo n.º 19
0
 public void SetUpState()
 {
     print("Up registered");
     CrossPlatformInputManager.SetButtonUp(Name);
 }
Exemplo n.º 20
0
 public void HandleInput(float value)
 {
     CrossPlatformInputManager.SetAxis(axis, (value * 2f) - 1f);
 }
Exemplo n.º 21
0
 public void SetAxisNegativeState()
 {
     CrossPlatformInputManager.SetAxisNegative(Name);
 }
Exemplo n.º 22
0
 public void SetDownState()
 {
     Debug.Log("Button Down");
     CrossPlatformInputManager.SetButtonDown(Name);
 }