// Update is called once per frame
    void Update()
    {
        p1Body.AddForce((Vector3.back * movePower * Input.GetAxis("HorizontalPlayer1")) + (Vector3.right * movePower * Input.GetAxis("VerticalPlayer1")));
        p2Body.AddForce((Vector3.back * movePower * Input.GetAxis("HorizontalPlayer2")) + (Vector3.right * movePower * Input.GetAxis("VerticalPlayer2")));

        if (Input.GetKeyDown(KeyCode.LeftShift))
        {
            p1Mag.Swap();
        }
        if (Input.GetKeyDown(KeyCode.RightShift))
        {
            p2Mag.Swap();
        }
    }
Beispiel #2
0
    void Update()
    {
        // Polarity swap
        if ((Input.GetButtonDown("PolarityPlayer1") && m_Player == Player.One) ||
            (Input.GetButtonDown("PolarityPlayer2") && m_Player == Player.Two))
        {
            Magnetic mag = GetComponent <Magnetic>();
            mag.Swap();
            AudioManager.PlaySFX(AudioManager.SFXClip.Magnet);
        }

        /*//Jump
         * if (    (Input.GetButtonDown("JumpPlayer1") && m_bGroundedPlayer && m_Player == Player.One)
         ||  (Input.GetButtonDown("JumpPlayer2") && m_bGroundedPlayer && m_Player == Player.Two))
         ||{
         || pengAnim.SetBool("isJumping", true);
         || m_bJumping = true;
         ||}
         ||
         ||// Running
         ||if (    (Input.GetButton("RunPlayer1") && m_bGroundedPlayer && m_Player == Player.One)
         ||  (Input.GetButton("RunPlayer2") && m_bGroundedPlayer && m_Player == Player.Two))
         ||{
         || m_bRunning = true;
         || pengAnim.SetBool("isRunning", true);
         || m_bSliding = false;
         ||}
         ||else
         ||{
         || m_bRunning = false;
         || pengAnim.SetBool("isRunning", false);
         ||}
         ||
         ||//Slide
         ||if (    (Input.GetButtonDown("SlidePlayer1") && m_Player == Player.One)
         ||  (Input.GetButtonDown("SlidePlayer2") && m_Player == Player.Two))
         ||{
         || m_bSliding = true;
         || pengAnim.SetBool("isSliding", true);
         ||}*/

        //Interact
        if ((Input.GetButtonDown("InteractPlayer1") && m_Player == Player.One) ||
            (Input.GetButtonDown("InteractPlayer2") && m_Player == Player.Two))
        {
            for (int i = 0; i < m_InteractablesList.Count; ++i)
            {
                m_InteractablesList[i].Interact();
            }
            Debug.Log("Interact");
        }

        //Grab
        if ((Input.GetButtonDown("GrabPlayer1") && m_Player == Player.One) ||
            (Input.GetButtonDown("GrabPlayer2") && m_Player == Player.Two))
        {
            for (int i = 0; i < m_GrabbablesList.Count; ++i)
            {
                m_GrabbablesList[i].Grab(gameObject);
            }
        }
    }