示例#1
0
 // Update is called once per frame
 void LateUpdate()
 {
     if (!XInput.GetConnected(0))
     {
         if (Input.GetKeyDown(KeyCode.Space))
         {
             addJump();
         }
     }
 }
示例#2
0
 // Update is called once per frame
 void Update()
 {
     if (XInput.GetConnected())
     {
         img.texture = XboxTex;
     }
     else
     {
         img.texture = KBTex;
     }
 }
示例#3
0
 void OnEnable()
 {
     if (XInput.GetConnected())
     {
         img.texture = XboxTex;
     }
     else
     {
         img.texture = KBTex;
     }
 }
示例#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();
                }
            }
        }
    }
示例#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();
        }
    }
示例#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);
            }
        }
    }
示例#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;
    }
示例#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);
        }
    }
示例#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);
    }