示例#1
0
    // Update is called once per frame
    void Update()
    {
        _ship.ThrustPos = Input.GetAxis("Horizontal");
        _ship.ThrustVel = Input.GetAxis("Vertical");
        _tool.Target    = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        if (Input.GetKey("1"))
        {
            _tool.SelectedTool = 0;
        }

        if (Input.GetKey("2"))
        {
            _tool.SelectedTool = 1;
        }

        if (Input.GetKey("3"))
        {
            _tool.SelectedTool = 2;
        }

        if (Input.GetMouseButtonDown(1))
        {
            _tool.SelectedTool = _tool.SelectedTool + 1;
        }

        if (Input.GetMouseButton(0))
        {
            _tool.ActivateMultiTool();
        }
    }
示例#2
0
 private void GetCloserOrActivateMultiTool(Vector3 target, float sqrDistance)
 {
     if ((target - transform.position).sqrMagnitude > sqrDistance)
     {
         Go(target);
     }
     else
     {
         multiTool.ActivateMultiTool();
     }
 }