コード例 #1
0
    void Update()
    {
        if (Input.GetMouseButton(0))
        {
            Vector3 screenPosition     = Camera.main.WorldToScreenPoint(organism.transform.position);
            Vector3 dependantDirection = Input.mousePosition - screenPosition;

            inputDirection = new Vector3(dependantDirection.x * (1f / (float)Screen.width), dependantDirection.y * (1f / (float)Screen.height));

            organism.Move(-inputDirection);
        }
        else if (Input.GetMouseButtonUp(0))
        {
            organism.Deactivate();
        }
    }