Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if (GlobalControl.NumPlayers >= 1)
        {
            if (GlobalControl.GetButtonDownA(1))
            {
                Debug.Log("A1 pressed");
            }
            else if (GlobalControl.GetButtonDownRT(1))
            {
                Debug.Log("RT1 pressed");
            }
        }
        if (GlobalControl.NumPlayers >= 2)
        {
            if (GlobalControl.GetButtonDownA(2))
            {
                Debug.Log("A2 pressed");
            }
            else if (GlobalControl.GetButtonDownRT(2))
            {
                Debug.Log("RT2 pressed");
            }
        }
        if (GlobalControl.NumPlayers >= 3)
        {
            if (GlobalControl.GetButtonDownA(3))
            {
                Debug.Log("A3 pressed");
            }
            else if (GlobalControl.GetButtonDownRT(3))
            {
                Debug.Log("RT3 pressed");
            }
        }
        if (GlobalControl.NumPlayers >= 4)
        {
            if (GlobalControl.GetButtonDownA(4))
            {
                Debug.Log("A4 pressed");
            }
            else if (GlobalControl.GetButtonDownRT(4))
            {
                Debug.Log("RT4 pressed");
            }
        }

        /*if (GlobalControl.GetButtonDownA(1)) Debug.Log("A1 pressed");
         * if (GlobalControl.GetButtonDownA(2)) Debug.Log("A2 pressed");
         * if (GlobalControl.GetButtonDownX(1)) Debug.Log("X pressed");
         * if (GlobalControl.GetButtonDownY(1)) Debug.Log("Y pressed");
         * if (GlobalControl.GetButtonDownStart(1)) Debug.Log("Start pressed");
         * if (GlobalControl.GetButtonDownBack(1)) Debug.Log("Back pressed");
         * if (GlobalControl.GetButtonDownRT(1)) Debug.Log("RT pressed");*/
        /*Debug.Log(GlobalControl.GetHorizontal(1));
         * Debug.Log(GlobalControl.GetVertical(1));
         * Debug.Log(GlobalControl.GetHorizontalAim(1));
         * Debug.Log(GlobalControl.GetVerticalAim(1));*/
    }
    // Update is called once per frame
    void Update()
    {
        //Horizontal movment for the character
        float inputX = GlobalControl.GetHorizontal(num);

        theRigidBody.velocity = new Vector2(inputX * speed, theRigidBody.velocity.y);



        //makes a character jump if they press A
        //want to make a double jump, you can only jup is you have a jump left.
        bool jump = GlobalControl.GetButtonDownA(num);


        if (jump && theRigidBody.transform.position.y < (-3.10) || jump && onFridge)
        {
            theRigidBody.velocity = new Vector2(theRigidBody.velocity.x, jumpPower);
        }
        if (onFridge)
        {
            animator.SetBool("isJumping", false);
        }
        if (transform.position.y < (-3.10) || onFridge)
        {
            animator.SetBool("isJumping", false);
        }
        else
        {
            animator.SetBool("isJumping", true);
        }
        animator.SetFloat("speed", Mathf.Abs(theRigidBody.velocity.x));

        if (theRigidBody.velocity.x < 0)
        {
            sR.flipX = true;
        }
        else
        {
            sR.flipX = false;
        }
        if (theRigidBody.transform.position.x > -7f || theRigidBody.transform.position.y > 0)
        {
            onFridge = false;
        }
    }
Beispiel #3
0
 // Update is called once per frame
 void Update()
 {
     if (GlobalControl.GetButtonDownB(playerNum) && readyToShoot)
     {
         FireMid();
         readyToShoot = false;
         Invoke("ResetReadyToShoot", delay);
     }
     if (GlobalControl.GetButtonDownY(playerNum) && readyToShoot)
     {
         FireHigh();
         readyToShoot = false;
         Invoke("ResetReadyToShoot", delay);
     }
     if (GlobalControl.GetButtonDownA(playerNum) && readyToShoot)
     {
         FireLow();
         readyToShoot = false;
         Invoke("ResetReadyToShoot", delay);
     }
 }
Beispiel #4
0
    // Update is called once per frame
    void Update()
    {
        if (p != null && !p.canMove)
        {
            if (GlobalControl.GetButtonDownA(p.playerNum))
            {
                GetComponent <Animator> ().SetBool("Apressed", false);

                frozenCount--;
            }
            else
            {
                GetComponent <Animator> ().SetBool("Apressed", true);
            }

            if (frozenCount <= 0)
            {
                p.canMove = true;
                GameObject.Destroy(gameObject);
            }
        }
    }