Ejemplo 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;
 }
Ejemplo 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));
    }
Ejemplo 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);
        }
    }
Ejemplo 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);
            }
        }
Ejemplo 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);
                }
            }
        }
Ejemplo 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);
    }
Ejemplo n.º 7
0
 public void SetDownState()
 {
     print("down registered");
     CrossPlatformInputManager.SetButtonDown(Name);
 }
Ejemplo n.º 8
0
 void HorizontalRotation()
 {
     transform.Rotate(Vector3.up, Time.deltaTime * rotationSpeed * InputManager.GetAxis(horizontalAxisName));
 }
Ejemplo n.º 9
0
 public override void OnPointerDown(PointerEventData data)
 {
     CrossPlatformInputManager.SetButtonDown(ButtonName);
 }
Ejemplo n.º 10
0
 public override void OnPointerUp(PointerEventData data)
 {
     CrossPlatformInputManager.SetButtonUp(ButtonName);
     base.OnPointerUp(data);
 }
Ejemplo n.º 11
0
 public override void OnEnable()
 {
     base.OnEnable();
     mVirtualButton = new CrossPlatformInputManager.VirtualButton(ButtonName);
     CrossPlatformInputManager.RegisterVirtualButton(mVirtualButton);
 }
Ejemplo n.º 12
0
 public void SetAxisNeutralState()
 {
     CrossPlatformInputManager.SetAxisZero(Name);
 }
Ejemplo n.º 13
0
 private void Update()
 {
     xAxis = InputManager.GetAxis(xAxisName);
     zAxis = InputManager.GetAxis(zAxisName);
 }
Ejemplo n.º 14
0
 public void SetDownState()
 {
     CrossPlatformInputManager.SetButtonDown(Name);
 }
Ejemplo 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();
        }
Ejemplo n.º 16
0
 public void SetUpState()
 {
     CrossPlatformInputManager.SetButtonUp(Name);
 }
Ejemplo n.º 17
0
        //}


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