Example #1
0
    void Update()
    {
        if (bodyToFollow == null)
        {
            universe.gameObject.GetComponent <ClaimUIHandler>().DisableProgressBars();
            Vector3 moveDirection = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
            transform.position += moveDirection * moveSpeed * Time.deltaTime;
        }
        else
        {
            universe.gameObject.GetComponent <ClaimUIHandler>().UpdateProgressBars(bodyToFollow.GetComponent <Body>());
            transform.position = new Vector3(bodyToFollow.transform.position.x, bodyToFollow.transform.position.y, transform.position.z);
        }

        if (Input.GetKey(KeyCode.Q))
        {
            GetComponent <Camera>().orthographicSize++;
        }
        if (Input.GetKey(KeyCode.E))
        {
            if (GetComponent <Camera>().orthographicSize - 1 >= 1)
            {
                GetComponent <Camera>().orthographicSize--;
            }
        }
        if (Input.GetMouseButtonDown(0))
        {
            bodyToFollow = universe.GetBodyAtLocation(Input.mousePosition);
        }
    }