Exemplo n.º 1
0
 public static void Box_Store(RobotData thisRobot)
 {
     //robot sprema selectirani box u container:
     //uništi box
     Object.Destroy(thisRobot.myTransform.Find("positionBox").GetChild(0).gameObject);
     //stopiraj robota i postavi mu parametre
     thisRobot.myRigidbody.velocity = Vector2.zero;
     thisRobot.myAnimator.SetBool("Walk", false);
     thisRobot.SetHasBox(false);
     thisRobot.selection = null;
 }
Exemplo n.º 2
0
    public static void Box_Pickup(RobotData thisRobot)
    {
        //robot uzima selectirani box na sebe:
        //isključi od sada nepotrebne kompnente boxa i ispravno postavi box gameobjekt
        Object.Destroy(thisRobot.selection.GetComponent <BoxCollider2D>());
        Object.Destroy(thisRobot.selection.GetComponent <Rigidbody2D>());
        Transform positionBox = thisRobot.myTransform.Find("positionBox");

        thisRobot.selection.SetParent(positionBox);
        thisRobot.selection.position = new Vector3(positionBox.position.x, positionBox.position.y, -1.1f);
        //stopiraj robota i postavi mu parametre
        thisRobot.myRigidbody.velocity = Vector2.zero;
        thisRobot.myAnimator.SetBool("Walk", false);
        thisRobot.SetHasBox(true);
        thisRobot.selection = null;
    }