Beispiel #1
0
    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);
    }
Beispiel #2
0
    // 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);
        }
    }
Beispiel #3
0
    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);
        }
    }
Beispiel #4
0
 // Update is called once per frame
 void Update()
 {
     _movebehaviour.move();
 }
Beispiel #5
0
 public void FixedUpdate()
 {
     _movebehaviour.move();
 }