void FixedUpdate() { /* * Vector3 posmouse = Input.mousePosition; * posmouse.z = 10; * Vector3 p = Camera.main.ScreenToWorldPoint(posmouse); * _alfa = Mathf.Atan2(p.y - transform.position.y, p.x - transform.position.x) * Mathf.Rad2Deg; * transform.rotation = Quaternion.AngleAxis(_alfa, Vector3.forward); */ float translation = Input.GetAxis("Vertical") * speed; float rotation = Input.GetAxis("Horizontal") * speedrotation; if (translation == 10) { _movebehaviour.move(transform.up); } if (translation == -10) { _movebehaviour.move(transform.up * -1); } translation *= Time.deltaTime; rotation *= Time.deltaTime; transform.Rotate(0, 0, rotation); }
// Update is called once per frame void Update() { if (Input.GetKey(KeyCode.D)) { _movebehaviour.move(new Vector2(1, 0)); } if (Input.GetKey(KeyCode.A)) { _movebehaviour.move(new Vector2(-1, 0)); } if (Input.GetKey(KeyCode.W)) { _movebehaviour.move(new Vector2(0, 1)); } if (Input.GetKey(KeyCode.S)) { _movebehaviour.move(new Vector2(0, -1)); } if (Input.GetKeyDown(KeyCode.Space)) { Instantiate(shotPrefab, shotPoint.transform.position, Quaternion.identity); } }
void Update() { /* * float translation = Input.GetAxis("Vertical") * speed; * float rotation = Input.GetAxis("Horizontal") * rotationSpeed; * translation*= Time.deltaTime; * rotation *= Time.deltaTime; * transform.Translate(0, 0, translation); * transform.Rotate(0, rotation, 0);*/ if (Input.GetAxis("Vertical") > 0) { _moveb.move(transform.up); } if (Input.GetAxis("Vertical") < 0) { _moveb.move(transform.up * -1); } if (Input.GetAxis("Horizontal") > 0) { _moveb.move(transform.right); } if (Input.GetAxis("Horizontal") < 0) { _moveb.move(transform.right * -1); } }
// Update is called once per frame void Update() { _movebehaviour.move(); }
public void FixedUpdate() { _movebehaviour.move(); }