コード例 #1
0
    //public GameObject Starter;
    //bool A = true;
    //bool B = true;

    // Use this for initialization
    void Awake()
    {
        isPlaying = false;
        isCopied  = false;
        //StartCoroutine ("Updat");
        Rb1  = B1.GetComponent <Rigidbody2D> ();
        Rb2  = B2.GetComponent <Rigidbody2D> ();
        Rb3  = B3.GetComponent <Rigidbody2D> ();
        Rb4  = B4.GetComponent <Rigidbody2D> ();
        Rb5  = B5.GetComponent <Rigidbody2D> ();
        Rb6  = B6.GetComponent <Rigidbody2D> ();
        Rb7  = B7.GetComponent <Rigidbody2D> ();
        Tr1  = B1.transform;
        Tr2  = B2.transform;
        Tr3  = B3.transform;
        Tr4  = B4.transform;
        Tr5  = B5.transform;
        Tr6  = B6.transform;
        Tr7  = B7.transform;
        Pos1 = Out1.transform.position;
        Pos2 = Out2.transform.position;
        Pos3 = Out3.transform.position;
        Pos4 = Out4.transform.position;
        Pos5 = Out5.transform.position;
        Pos6 = Out6.transform.position;
        Pos7 = Out7.transform.position;
        S    = GetComponent <SpriteRenderer> ();
    }
コード例 #2
0
 void Reset()
 {
     isPlaying = false;
     isCopied  = false;
     B1.GetComponent <TrailRenderer>().time = 0.0f;
     B1.SetActive(false);
     B1.GetComponent <Ball>().Dead          = false;
     B2.GetComponent <TrailRenderer>().time = 0.0f;
     B2.SetActive(false);
     B2.GetComponent <Ball>().Dead = false;
     B3.SetActive(false);
     B3.GetComponent <TrailRenderer>().time = 0.0f;
     B3.GetComponent <Ball>().Dead          = false;
     B4.SetActive(false);
     B4.GetComponent <TrailRenderer>().time = 0.0f;
     B4.GetComponent <Ball>().Dead          = false;
     B5.SetActive(false);
     B5.GetComponent <TrailRenderer>().time = 0.0f;
     B5.GetComponent <Ball>().Dead          = false;
     B6.SetActive(false);
     B6.GetComponent <TrailRenderer>().time = 0.0f;
     B6.GetComponent <Ball>().Dead          = false;
     B7.SetActive(false);
     B7.GetComponent <TrailRenderer>().time = 0.0f;
     B7.GetComponent <Ball>().Dead          = false;
     ChangeColor(0);
 }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        PlayerIcon.GetComponent <SpriteRenderer>().enabled = true;
        A1.GetComponent <SpriteRenderer>().enabled         = false;
        A2.GetComponent <SpriteRenderer>().enabled         = false;
        A3.GetComponent <SpriteRenderer>().enabled         = false;
        A4.GetComponent <SpriteRenderer>().enabled         = false;
        A5.GetComponent <SpriteRenderer>().enabled         = false;
        A6.GetComponent <SpriteRenderer>().enabled         = false;
        A7.GetComponent <SpriteRenderer>().enabled         = false;
        A8.GetComponent <SpriteRenderer>().enabled         = false;
        A9.GetComponent <SpriteRenderer>().enabled         = false;
        A10.GetComponent <SpriteRenderer>().enabled        = false;
        A11.GetComponent <SpriteRenderer>().enabled        = false;
        B1.GetComponent <SpriteRenderer>().enabled         = false;
        B2.GetComponent <SpriteRenderer>().enabled         = false;
        B3.GetComponent <SpriteRenderer>().enabled         = false;
        B4.GetComponent <SpriteRenderer>().enabled         = false;
        B5.GetComponent <SpriteRenderer>().enabled         = false;
        B6.GetComponent <SpriteRenderer>().enabled         = false;
        B7.GetComponent <SpriteRenderer>().enabled         = false;
        B8.GetComponent <SpriteRenderer>().enabled         = false;
        B9.GetComponent <SpriteRenderer>().enabled         = false;
        B10.GetComponent <SpriteRenderer>().enabled        = false;
        B11.GetComponent <SpriteRenderer>().enabled        = false;
        C1.GetComponent <SpriteRenderer>().enabled         = false;
        C2.GetComponent <SpriteRenderer>().enabled         = false;
        C3.GetComponent <SpriteRenderer>().enabled         = false;
        C4.GetComponent <SpriteRenderer>().enabled         = false;
        C5.GetComponent <SpriteRenderer>().enabled         = false;
        C6.GetComponent <SpriteRenderer>().enabled         = false;
        C7.GetComponent <SpriteRenderer>().enabled         = false;
        C8.GetComponent <SpriteRenderer>().enabled         = false;
        C9.GetComponent <SpriteRenderer>().enabled         = false;
        C10.GetComponent <SpriteRenderer>().enabled        = false;
        C11.GetComponent <SpriteRenderer>().enabled        = false;
        D1.GetComponent <SpriteRenderer>().enabled         = false;
        D2.GetComponent <SpriteRenderer>().enabled         = false;
        D3.GetComponent <SpriteRenderer>().enabled         = false;
        D4.GetComponent <SpriteRenderer>().enabled         = false;
        D5.GetComponent <SpriteRenderer>().enabled         = false;
        D6.GetComponent <SpriteRenderer>().enabled         = false;
        D7.GetComponent <SpriteRenderer>().enabled         = false;
        D8.GetComponent <SpriteRenderer>().enabled         = false;
        D9.GetComponent <SpriteRenderer>().enabled         = false;
        D10.GetComponent <SpriteRenderer>().enabled        = false;
        D11.GetComponent <SpriteRenderer>().enabled        = false;
        E1.GetComponent <SpriteRenderer>().enabled         = false;
        E2.GetComponent <SpriteRenderer>().enabled         = false;
        E3.GetComponent <SpriteRenderer>().enabled         = false;
        E4.GetComponent <SpriteRenderer>().enabled         = false;
        E5.GetComponent <SpriteRenderer>().enabled         = false;
        E6.GetComponent <SpriteRenderer>().enabled         = false;
        E7.GetComponent <SpriteRenderer>().enabled         = false;
        E8.GetComponent <SpriteRenderer>().enabled         = false;
        E9.GetComponent <SpriteRenderer>().enabled         = false;
        E10.GetComponent <SpriteRenderer>().enabled        = false;
        E11.GetComponent <SpriteRenderer>().enabled        = false;
        F1.GetComponent <SpriteRenderer>().enabled         = false;
        F2.GetComponent <SpriteRenderer>().enabled         = false;
        F3.GetComponent <SpriteRenderer>().enabled         = false;
        F4.GetComponent <SpriteRenderer>().enabled         = false;
        F5.GetComponent <SpriteRenderer>().enabled         = false;
        F6.GetComponent <SpriteRenderer>().enabled         = false;
        F7.GetComponent <SpriteRenderer>().enabled         = false;
        F8.GetComponent <SpriteRenderer>().enabled         = false;
        F9.GetComponent <SpriteRenderer>().enabled         = false;
        F10.GetComponent <SpriteRenderer>().enabled        = false;
        F11.GetComponent <SpriteRenderer>().enabled        = false;
        G1.GetComponent <SpriteRenderer>().enabled         = false;
        G2.GetComponent <SpriteRenderer>().enabled         = false;
        G3.GetComponent <SpriteRenderer>().enabled         = false;
        G4.GetComponent <SpriteRenderer>().enabled         = false;
        G5.GetComponent <SpriteRenderer>().enabled         = false;
        G6.GetComponent <SpriteRenderer>().enabled         = false;
        G7.GetComponent <SpriteRenderer>().enabled         = false;
        G8.GetComponent <SpriteRenderer>().enabled         = false;
        G9.GetComponent <SpriteRenderer>().enabled         = false;
        G10.GetComponent <SpriteRenderer>().enabled        = false;
        G11.GetComponent <SpriteRenderer>().enabled        = false;
        H1.GetComponent <SpriteRenderer>().enabled         = false;
        H2.GetComponent <SpriteRenderer>().enabled         = false;
        H3.GetComponent <SpriteRenderer>().enabled         = false;
        H4.GetComponent <SpriteRenderer>().enabled         = false;
        H5.GetComponent <SpriteRenderer>().enabled         = false;
        H6.GetComponent <SpriteRenderer>().enabled         = false;
        H7.GetComponent <SpriteRenderer>().enabled         = false;
        H8.GetComponent <SpriteRenderer>().enabled         = false;
        H9.GetComponent <SpriteRenderer>().enabled         = false;
        H10.GetComponent <SpriteRenderer>().enabled        = false;
        H11.GetComponent <SpriteRenderer>().enabled        = false;
        I1.GetComponent <SpriteRenderer>().enabled         = false;
        I2.GetComponent <SpriteRenderer>().enabled         = false;
        I3.GetComponent <SpriteRenderer>().enabled         = false;
        I4.GetComponent <SpriteRenderer>().enabled         = false;
        I5.GetComponent <SpriteRenderer>().enabled         = false;
        I6.GetComponent <SpriteRenderer>().enabled         = false;
        I7.GetComponent <SpriteRenderer>().enabled         = false;
        I8.GetComponent <SpriteRenderer>().enabled         = false;
        I9.GetComponent <SpriteRenderer>().enabled         = false;
        I10.GetComponent <SpriteRenderer>().enabled        = false;
        I11.GetComponent <SpriteRenderer>().enabled        = false;
        J1.GetComponent <SpriteRenderer>().enabled         = false;
        J2.GetComponent <SpriteRenderer>().enabled         = false;
        J3.GetComponent <SpriteRenderer>().enabled         = false;
        J4.GetComponent <SpriteRenderer>().enabled         = false;
        J5.GetComponent <SpriteRenderer>().enabled         = false;
        J6.GetComponent <SpriteRenderer>().enabled         = false;
        J7.GetComponent <SpriteRenderer>().enabled         = false;
        J8.GetComponent <SpriteRenderer>().enabled         = false;
        J9.GetComponent <SpriteRenderer>().enabled         = false;
        J10.GetComponent <SpriteRenderer>().enabled        = false;
        J11.GetComponent <SpriteRenderer>().enabled        = false;
        K1.GetComponent <SpriteRenderer>().enabled         = false;
        K2.GetComponent <SpriteRenderer>().enabled         = false;
        K3.GetComponent <SpriteRenderer>().enabled         = false;
        K4.GetComponent <SpriteRenderer>().enabled         = false;
        K5.GetComponent <SpriteRenderer>().enabled         = false;
        K6.GetComponent <SpriteRenderer>().enabled         = false;
        K7.GetComponent <SpriteRenderer>().enabled         = false;
        K8.GetComponent <SpriteRenderer>().enabled         = false;
        K9.GetComponent <SpriteRenderer>().enabled         = false;
        K10.GetComponent <SpriteRenderer>().enabled        = false;
        K11.GetComponent <SpriteRenderer>().enabled        = false;
        float ratio = Screen.width / Screen.height;

        if (ratio < 2)
        {
            int screenx = 543;
            int screeny = 653;
        }
        else
        {
            int screenx = 743;
            int screeny = 853;
        }
    }
コード例 #4
0
    IEnumerator Rexar(int Layer, Collider2D other)
    {
        B1.SetActive(true);
        Tr1.position = Pos1;
        B1.layer     = Layer;
        B1.GetComponent <Ball> ().Direction = Direction1;

        B2.SetActive(true);
        Tr2.position = Pos2;
        B2.layer     = Layer;
        B2.GetComponent <Ball> ().Direction = Direction2;
        //Rb2 = other.GetComponent<Rigidbody2D> ();
        B3.SetActive(true);
        Tr3.position = Pos3;
        B3.layer     = Layer;
        B3.GetComponent <Ball> ().Direction = Direction2;

        B4.SetActive(true);
        Tr4.position = Pos4;
        B4.layer     = Layer;
        B4.GetComponent <Ball> ().Direction = Direction2;

        B5.SetActive(true);
        Tr5.position = Pos5;
        B5.layer     = Layer;
        B5.GetComponent <Ball> ().Direction = Direction2;

        B6.SetActive(true);
        Tr6.position = Pos6;
        B6.layer     = Layer;
        B6.GetComponent <Ball> ().Direction = Direction2;

        B7.SetActive(true);
        Tr7.position = Pos7;
        B7.layer     = Layer;
        B7.GetComponent <Ball> ().Direction = Direction2;
        yield return(new WaitForSeconds(0.1f));

        Rb1.Sleep();
        B1.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Rb2.Sleep();
        B2.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Rb3.Sleep();
        B3.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Rb4.Sleep();
        B4.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Rb5.Sleep();
        B5.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Rb6.Sleep();
        B6.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Rb7.Sleep();
        B7.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Tr1.position = Pos1;
        Tr2.position = Pos2;
        Tr3.position = Pos3;
        Tr4.position = Pos4;
        Tr5.position = Pos5;
        Tr6.position = Pos6;
        Tr7.position = Pos7;



        if (Direction1.Equals(1))
        {
            Rb1.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction1.Equals(2))
        {
            Rb1.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction1.Equals(3))
        {
            Rb1.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction1.Equals(4))
        {
            Rb1.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction1.Equals(8))
        {
            Rb1.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction1.Equals(7))
        {
            Rb1.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction1.Equals(6))
        {
            Rb1.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction1.Equals(5))
        {
            Rb1.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction1.Equals(9))
        {
            Rb1.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction1.Equals(10))
        {
            Rb1.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction1.Equals(11))
        {
            Rb1.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction1.Equals(12))
        {
            Rb1.AddForce(V * new Vector2(178.9869f, -89.24f));
        }


        if (Direction2.Equals(1))
        {
            Rb2.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction2.Equals(2))
        {
            Rb2.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction2.Equals(3))
        {
            Rb2.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction2.Equals(4))
        {
            Rb2.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction2.Equals(6))
        {
            Rb2.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction2.Equals(7))
        {
            Rb2.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction2.Equals(8))
        {
            Rb2.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction2.Equals(5))
        {
            Rb2.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction2.Equals(9))
        {
            Rb2.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction2.Equals(10))
        {
            Rb2.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction2.Equals(11))
        {
            Rb2.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction2.Equals(12))
        {
            Rb2.AddForce(V * new Vector2(178.9869f, -89.24f));
        }


        if (Direction3.Equals(1))
        {
            Rb3.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction3.Equals(2))
        {
            Rb3.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction3.Equals(3))
        {
            Rb3.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction3.Equals(4))
        {
            Rb3.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction3.Equals(6))
        {
            Rb3.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction3.Equals(7))
        {
            Rb3.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction3.Equals(8))
        {
            Rb3.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction3.Equals(5))
        {
            Rb3.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction3.Equals(9))
        {
            Rb1.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction3.Equals(10))
        {
            Rb3.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction3.Equals(11))
        {
            Rb3.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction3.Equals(12))
        {
            Rb3.AddForce(V * new Vector2(178.9869f, -89.24f));
        }


        if (Direction4.Equals(1))
        {
            Rb4.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction4.Equals(2))
        {
            Rb4.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction4.Equals(3))
        {
            Rb4.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction4.Equals(4))
        {
            Rb4.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction4.Equals(6))
        {
            Rb4.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction4.Equals(7))
        {
            Rb4.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction4.Equals(8))
        {
            Rb4.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction4.Equals(5))
        {
            Rb4.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction4.Equals(9))
        {
            Rb4.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction4.Equals(10))
        {
            Rb4.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction4.Equals(11))
        {
            Rb4.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction4.Equals(12))
        {
            Rb4.AddForce(V * new Vector2(178.9869f, -89.24f));
        }

        if (Direction5.Equals(1))
        {
            Rb5.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction5.Equals(2))
        {
            Rb5.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction5.Equals(3))
        {
            Rb5.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction5.Equals(4))
        {
            Rb5.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction5.Equals(6))
        {
            Rb5.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction5.Equals(7))
        {
            Rb5.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction5.Equals(8))
        {
            Rb5.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction5.Equals(5))
        {
            Rb5.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction5.Equals(9))
        {
            Rb5.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction5.Equals(10))
        {
            Rb5.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction5.Equals(11))
        {
            Rb5.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction5.Equals(12))
        {
            Rb5.AddForce(V * new Vector2(178.9869f, -89.24f));
        }

        if (Direction6.Equals(1))
        {
            Rb6.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction6.Equals(2))
        {
            Rb6.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction6.Equals(3))
        {
            Rb6.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction6.Equals(4))
        {
            Rb6.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction6.Equals(6))
        {
            Rb6.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction6.Equals(7))
        {
            Rb6.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction6.Equals(8))
        {
            Rb6.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction6.Equals(5))
        {
            Rb6.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction6.Equals(9))
        {
            Rb6.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction6.Equals(10))
        {
            Rb6.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction6.Equals(11))
        {
            Rb6.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction6.Equals(12))
        {
            Rb6.AddForce(V * new Vector2(178.9869f, -89.24f));
        }

        if (Direction7.Equals(1))
        {
            Rb7.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction7.Equals(2))
        {
            Rb7.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction7.Equals(3))
        {
            Rb7.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction7.Equals(4))
        {
            Rb7.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction7.Equals(6))
        {
            Rb7.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction7.Equals(7))
        {
            Rb7.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction7.Equals(8))
        {
            Rb7.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction7.Equals(5))
        {
            Rb7.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction7.Equals(9))
        {
            Rb7.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction7.Equals(10))
        {
            Rb7.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction7.Equals(11))
        {
            Rb7.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction7.Equals(12))
        {
            Rb7.AddForce(V * new Vector2(178.9869f, -89.24f));
        }
        B1.GetComponent <Ball> ().Direction = Direction1;
        B2.GetComponent <Ball> ().Direction = Direction2;
        B3.GetComponent <Ball> ().Direction = Direction3;
        B4.GetComponent <Ball> ().Direction = Direction4;
        B5.GetComponent <Ball> ().Direction = Direction5;
        B6.GetComponent <Ball> ().Direction = Direction6;
        B7.GetComponent <Ball> ().Direction = Direction7;

        other.GetComponent <Rigidbody2D>().Sleep();
    }