Esempio n. 1
0
 void FixedUpdate()
 {
     if (move.checkWall() == true && inv.getElement(2) == true)
     {
         if (Input.GetButtonDown("Fire3"))
         {
             if (tog == true)
             {
                 tog = false;
             }
             else
             {
                 tog = true;
             }
         }
     }
     if (move.checkWall() == false)
     {
         tog = false;
     }
 }
Esempio n. 2
0
    void Update()
    {
        if (incharge == true)
        {
            if (lcolman.getInCollision() == true || rcolman.getInCollision() == true)
            {
                if (lcolman.getGameObject().tag == "breakable" || lcolman.getGameObject().tag == "enemy")
                {
                    wall = lcolman.getGameObject();
                    Destroy(wall);
                }
                if (rcolman.getGameObject().tag == "breakable" || rcolman.getGameObject().tag == "enemy")
                {
                    wall = rcolman.getGameObject();
                    Destroy(wall);
                }

                if (move.checkWall() == true)
                {
                    incharge = false;
                }
            }
            if (player.GetComponent <Transform>().position.x >= endposx && pos == true)
            {
                pos      = false;
                incharge = false;
            }
            if (player.GetComponent <Transform>().position.x < endposx && pos == true)
            {
                player.GetComponent <Rigidbody2D>().AddForce(new Vector2(cspeed * 100, 0));
            }
            if (player.GetComponent <Transform>().position.x <= endposx && neg == true)
            {
                neg      = false;
                incharge = false;
            }
            if (player.GetComponent <Transform>().position.x > endposx && neg == true)
            {
                player.GetComponent <Rigidbody2D>().AddForce(new Vector2((-1 * cspeed) * 100, 0));
            }
        }
    }