Exemplo n.º 1
0
 // Update is called once per frame
 void LateUpdate()
 {
     if (!XInput.GetConnected(0))
     {
         if (Input.GetKeyDown(KeyCode.Space))
         {
             addJump();
         }
     }
 }
Exemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     if (XInput.GetConnected())
     {
         img.texture = XboxTex;
     }
     else
     {
         img.texture = KBTex;
     }
 }
Exemplo n.º 3
0
 void OnEnable()
 {
     if (XInput.GetConnected())
     {
         img.texture = XboxTex;
     }
     else
     {
         img.texture = KBTex;
     }
 }
Exemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        element = type.curElement;

        if (!PauseMenu.paused)
        {
            if (!XInput.GetConnected(0))
            {
                if (Input.GetKeyDown(KeyCode.Mouse0))
                {
                    //Debug.Log("Shooting");
                    Fire();
                }
            }
        }
    }
Exemplo n.º 5
0
    // Update is called once per frame
    void FixedUpdate()
    {
        Debug.Log("Arduino Connected: " + controller.connected);

        if (controller.connected)
        {
            ArduinoInputs();
        }
        else if (XInput.GetConnected())
        {
            ControllerInputs();
        }
        else
        {
            KeyboardInputs();
        }
    }
Exemplo n.º 6
0
    // Update is called once per frame
    void LateUpdate()
    {
        if (!PauseMenu.paused && Elemental.Alive)
        {
            if (XInput.GetConnected(0))
            {
                leftStick = XInput.GetLeftStick(0);

                Move(leftStick.xAxis, leftStick.yAxis);
            }
            else
            {
                float moveX = Input.GetAxis("Horizontal");
                float moveY = Input.GetAxis("Vertical");

                Move(moveX, moveY);
            }
        }
    }
Exemplo n.º 7
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (dissolveTime < 1f && !dying)
        {
            dissolveTime += Time.fixedDeltaTime * dissolveSpeed;
        }

        if (health <= 0)
        {
            BeginDeath();
        }

        if (dying && dissolveTime > 0f)
        {
            dissolveTime -= Time.fixedDeltaTime * dissolveSpeed;
        }
        else if (dying && dissolveTime <= 0f)
        {
            re_enable();
        }
        else
        {
            //do nothing?
        }

        rend.material.SetFloat("DissolveState", dissolveTime);

        healthBar.transform.localScale = new Vector3(Mathf.Lerp(0f, startScaleBar, (float)health / maxHealth), healthBar.transform.localScale.y, 0f);

        if (!XInput.GetConnected())
        {
            if (Input.GetKeyDown(KeyCode.L))
            {
                ManualReset();
            }
        }

        Vector3 tempForward = transform.position - playerT.position;

        tempForward.y = 0f;

        transform.forward = tempForward;
    }
Exemplo n.º 8
0
    void InputChecks()
    {
        if (XInput.GetConnected(0))
        {
            XInput.DownloadPackets(1);
            rightStick = XInput.GetRightStick(0);

            camControl.x += rightStick.xAxis;
            camControl.y += -rightStick.yAxis;

            //Debug.Log(rightStick.xAxis + ", " + rightStick.yAxis);

            CameraMove(camControl);
        }
        else
        {
            camControl.x += Input.GetAxis("Mouse X");
            camControl.y += -Input.GetAxis("Mouse Y");

            CameraMove(camControl);
        }
    }
Exemplo n.º 9
0
    // Update is called once per frame
    void LateUpdate()
    {
        if (!PauseMenu.paused)
        {
            if (!XInput.GetConnected())
            {
                if (Input.mouseScrollDelta.y > 0)
                {
                    elementSelect += 1u;
                }
                else if (Input.mouseScrollDelta.y < 0)
                {
                    elementSelect -= 1u;
                }

                if (Input.GetKeyDown(KeyCode.L))
                {
                    resetPlayer();
                }
            }
        }

        if (health <= 0)
        {
            Alive = false;
            EndScreen.GetComponent <EndScreenText>().winner = false;
            EndScreen.SetActive(true);
        }

        uint temp = elementSelect % 4;

        curElement = (Elements)temp;

        GetComponent <MeshRenderer>().material.SetColor("PlayerColor", colours[temp] * colourMod);

        healthBar.transform.localScale = new Vector3(Mathf.Lerp(0f, 2f, (float)health / maxHealth), 0.17011f, 0f);
    }