Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Update ()
- {
- Move();
- Lose();
- MoveAcc();
- }
- public void Move()
- {
- if (Input.GetAxisRaw("Horizontal") > 0)
- {
- transform.Translate(new Vector3(Input.GetAxisRaw("Horizontal") * moveSpeed * Time.deltaTime, 0, 0));
- }
- if (Input.GetAxisRaw("Horizontal") < 0)
- {
- transform.Translate(new Vector3(Input.GetAxisRaw("Horizontal") * moveSpeed * Time.deltaTime, 0, 0));
- }
- }
- public void MoveAcc()
- {
- float acc = Input.acceleration.x;
- transform.Translate(acc, 0, 0);
- }
- public void Lose()
- {
- if(transform.position.x <= -3 || transform.position.x >= 3 )
- {
- loseCanvas.gameObject.SetActive(true);
- Time.timeScale = 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement