Example #1
0
 void Start()
 {
     GetComponent <Rigidbody2D>().velocity = transform.right.normalized * speed;
     hantei = GetComponent <Hantei>();
     One    = true;
 }
Example #2
0
    bool One;                                  // Instantiateを1回だけ呼ぶための準備

    private void Start()
    {
        // Hanteiコンポーネントを取得
        hantei = GetComponent <Hantei>();
    }
Example #3
0
    void OnTriggerStay(Collider other)
    {
        if (osita && !move)
        {
            if (!way)
            {
                switch (other.gameObject.tag)
                {
                case "Normal":
                    Debug.Log("hit");
                    move = true;
                    break;

                case "Right":
                    hantei = Hantei.Right;
                    put    = 0;
                    Debug.Log("hit");
                    move = true;
                    break;

                case "Left":
                    hantei = Hantei.Left;
                    put    = 1;
                    Debug.Log("hit");
                    move = true;
                    break;

                case "Up":
                    hantei = Hantei.Up;
                    put    = 2;
                    Debug.Log("hit");
                    move = true;
                    break;

                case "Down":
                    hantei = Hantei.Down;
                    Debug.Log("hit");
                    put  = 3;
                    move = true;
                    break;

                case "Goal":

                    Debug.Log("Goal");
                    SceneManager.LoadScene("Goal");
                    break;

                case "Drop":
                    GetComponent <Rigidbody>().useGravity = true;
                    break;

                case "Destroy":
                    Scene loadScene = SceneManager.GetActiveScene();
                    SceneManager.LoadScene(loadScene.name);
                    break;
                }
            }
            else
            {
                switch (right_Side)
                {
                case "Right":
                    hantei = Hantei.Right;
                    put    = 0;
                    move   = true;
                    way    = false;
                    break;

                case "Left":
                    hantei = Hantei.Left;
                    put    = 1;
                    move   = true;
                    way    = false;
                    break;

                case "Up":
                    hantei = Hantei.Up;
                    put    = 2;
                    move   = true;
                    way    = false;
                    break;

                case "Down":
                    hantei = Hantei.Down;
                    put    = 3;
                    move   = true;
                    way    = false;
                    break;
                }
            }
        }
        //if (!move && other.gameObject.tag == "down")
        //{
        //    hantei = Hantei.Down;
        //    Debug.Log("hit");

        //}
    }