Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        KoitanDebug.Display("デバッグ表示です\n");
        KoitanDebug.Display((1f / Time.unscaledDeltaTime).ToString() + "\n");
        string s = "pos : " + transform.position.ToString() + "\nrot : " + transform.rotation.eulerAngles.ToString() + "\nscale : " + transform.lossyScale.ToString();

        KoitanDebug.DisplayBox(s, this);
    }
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKey(KeyCode.UpArrow))
     {
         KoitanDebug.Display("Up\n");
     }
     if (Input.GetKey(KeyCode.DownArrow))
     {
         KoitanDebug.Display("Down\n");
     }
     if (Input.GetKey(KeyCode.RightArrow))
     {
         KoitanDebug.Display("Right\n");
     }
     if (Input.GetKey(KeyCode.LeftArrow))
     {
         KoitanDebug.Display("Left\n");
     }
 }
    void Update()
    {
        //操作説明
        KoitanDebug.Display("Rでリセット\n");
        KoitanDebug.Display("左クリックで掴む\n");

        if (isThrowed)
        {
            Vector3 pos = Camera.main.transform.position;
            Vector3 vec = transform.position - pos;
            vec.y = 0;
            vec.z = 0;
            vec  *= 0.9f;
            Camera.main.transform.position += vec;
            Camera.main.orthographicSize    = Mathf.Max(12, transform.position.y + 12);
            KoitanDebug.Display("飛んだ距離:" + transform.position.x.ToString() + "m\n");
        }
        else
        {
            Vector3 p = Camera.main.ScreenPointToRay(Input.mousePosition).origin;
            p.z = 0;

            if (Input.GetMouseButton(0))
            {
                rb.velocity = (p - this.prev) * power;
            }
            this.prev = p;

            if (Input.GetMouseButtonUp(0))
            {
                rb.isKinematic = false;
                col.enabled    = true;
                isThrowed      = true;
            }
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().name);
        }
    }