Esempio n. 1
0
    void Update()
    {
        if (velocity > 1)
        {
            velocity -= 0.05f;
        }
        if (Input.GetKey(KeyCode.RightArrow))
        {
            Rotate_Ship("right");
        }
        else if (Input.GetKey(KeyCode.LeftArrow))
        {
            Rotate_Ship("left");
        }
        else if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            Vector3.Normalize(new_ship_position);
            accumulated_velocity += new_ship_position * velocity;
            ship_animator.SetBool("Up Arrow", true);
            ship_thrust_timer = Time.time;
        }

        if (Time.time - ship_thrust_timer > 0.5f)
        {
            ship_animator.SetBool("Up Arrow", false);
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            ship_offset      = new_ship_position * 0.5f;
            projectile_clone = Instantiate(projectile, ship_body.position + ship_offset, Quaternion.identity);
            projectile_clone.transform.eulerAngles = ship_body.eulerAngles;
        }

        ship_body.position += accumulated_velocity * Time.deltaTime;

        game.Warp_Object(ship_body);
    }
Esempio n. 2
0
    void Update()
    {
        transform.position = transform.position + movement_vector * Time.deltaTime;

        game.Warp_Object(transform);
    }