Exemplo n.º 1
0
    public void OnTriggerEnter2D(Collider2D some)
    {
        if (some.gameObject.tag == "Player")
        {
            CharacterPos.setTent();

            SceneManager.LoadScene("Scenes/DarkWorld", LoadSceneMode.Single);
        }
    }
Exemplo n.º 2
0
 public void back()
 {
     Debug.Log("backed");
     CharacterPos.setTent();
     SceneManager.LoadScene("Scenes/DarkWorld", LoadSceneMode.Single);
     Bag_Fighter.b_fighter = 0;
     Bag_Wizard.b_wizard   = 0;
     Bag_Archer.b_archer   = 0;
 }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        breadtext.text = "Bread: " + Mathf.Ceil(Bag_Bread.bagbread) + "       Keys: " + keys;

        if (needBread() == true)
        {
            CharacterPos.setTent();
            SceneManager.LoadScene("Scenes/DarkWorld", LoadSceneMode.Single);
            Bag_Archer.b_archer   = 0;
            Bag_Wizard.b_wizard   = 0;
            Bag_Fighter.b_fighter = 0;
        }

        if ((Input.GetAxisRaw("Horizontal") > -0.5f) && (Input.GetAxisRaw("Horizontal") < 0.5f))
        {
            myrigidbody.velocity = new Vector2(0f, myrigidbody.velocity.y);
            ani.SetBool("Idle", true);
            ani.SetBool("Walk", false);
        }
        if ((Input.GetAxisRaw("Vertical") < 0.5f) && (Input.GetAxisRaw("Vertical") > -0.5f))
        {
            myrigidbody.velocity = new Vector2(myrigidbody.velocity.x, 0f);
            ani.SetBool("Idle", true);
            ani.SetBool("Walk", false);
        }

        if ((Input.GetAxisRaw("Horizontal") > 0.5f))
        {
            ani.SetBool("Walk", true);
            //transform.Translate(new Vector3(Input.GetAxisRaw("Horizontal") *playerSpeed *Time.deltaTime,0f,0f));
            myrigidbody.velocity = new Vector2(Input.GetAxisRaw("Horizontal") * playerSpeed, myrigidbody.velocity.y);

            Bag_Bread.bagbread   = Bag_Bread.bagbread - 0.02f;
            transform.localScale = new Vector3(-1, 1, -1);
        }

        if ((Input.GetAxisRaw("Horizontal") < -0.5f))
        {
            ani.SetBool("Walk", true);
            //transform.Translate(new Vector3(Input.GetAxisRaw("Horizontal") *playerSpeed *Time.deltaTime,0f,0f));
            myrigidbody.velocity = new Vector2(Input.GetAxisRaw("Horizontal") * playerSpeed, myrigidbody.velocity.y);
            Bag_Bread.bagbread   = Bag_Bread.bagbread - 0.02f;
            transform.localScale = new Vector3(1, 1, -1);
        }


        if ((Input.GetAxisRaw("Vertical") > 0.5f) || (Input.GetAxisRaw("Vertical") < -0.5f))
        {
            ani.SetBool("Walk", true);
            //transform.Translate(new Vector3(0f,Input.GetAxisRaw("Vertical") * playerSpeed * Time.deltaTime, 0f));
            myrigidbody.velocity = new Vector2(myrigidbody.velocity.x, Input.GetAxisRaw("Vertical") * playerSpeed);
            Bag_Bread.bagbread   = Bag_Bread.bagbread - 0.02f;
        }
        // anim1.SetFloat("Movex", Input.GetAxisRaw("Horizontal"));
        // anim1.SetFloat("Movey", Input.GetAxisRaw("Vertical"));
    }
Exemplo n.º 4
0
    public void goHome()
    {
        CharacterPos.setTent();

        SceneManager.LoadScene("Scenes/DarkWorld", LoadSceneMode.Single);
    }