// Update is called once per frame void Update() { inputMap.UpdateInputStates(); if (rbody.velocity.y > 0) { anim.Play("Walking_back"); } else if (rbody.velocity.y < 0 || rbody.velocity.x != 0) { anim.Play("Walking_front"); } else { anim.Play("Idle"); } if (rbody.velocity.x > 0) { GetComponent <SpriteRenderer>().flipX = true; } else if (rbody.velocity.x < 0) { GetComponent <SpriteRenderer>().flipX = false; } if (inputMap.GetKeyDown(Inputs.BUTTON_INTERACT)) { interactWithObjects(); } if (bulletSpawner) { Vector2 firingDirection = new Vector2(inputMap.GetAxis(Inputs.AXIS_CAM_X), inputMap.GetAxis(Inputs.AXIS_CAM_Y)); // Set a new angle if non zero aim input if (firingDirection != Vector2.zero) { float angle = Vector2.SignedAngle(Vector2.down, firingDirection); bulletSpawner.SetRotation(new Vector3(0, 0, angle)); } bulletSpawner.SetFiring(inputMap.GetKey(Inputs.BUTTON_FIRE)); } if (inventoryMgr) { if (inputMap.GetKeyDown(Inputs.BUTTON_SCROLL_LEFT)) { inventoryMgr.ScrollActiveItem(false); } if (inputMap.GetKeyDown(Inputs.BUTTON_SCROLL_RIGHT)) { inventoryMgr.ScrollActiveItem(true); } } }