Ejemplo n.º 1
0
    public void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.CompareTag("Player"))
        {
            Debug.Log("Destroy");

            int posix  = (int)this.transform.position.x;
            int posiz  = (int)this.transform.position.z;
            int posixs = posix + 6;
            int posizs = posiz + 5;

            int posix2  = (int)this.transform.position.x;
            int posiz2  = (int)this.transform.position.y;
            int posixs2 = posix2 + 6;
            int posizs2 = posiz2 - 9;

            anotherScript.NewNumber(posixs, posizs, 0);
            anotherScript.NewNumber2(posixs2, posizs2, 0);


            Destroy(this.gameObject);
            //Debug.Log(posixs +","+posizs +"のfirecountは"+anotherScript.number[posixs, posizs]);
            //Debug.Log(anotherScript.number[2, 2]);

            //Debug.Log(posixs);
            //Debug.Log(posizs);
            //Debug.Log(posixs +","+posizs +"のfirecountは"+anotherScript.number[posixs, posizs]);
        }
    }
Ejemplo n.º 2
0
    void FireCreate()
    {
        if (createCount < 2)
        {
            posix = Random.Range(-6, 3);
            posiz = Random.Range(-5, 1);
            transform.position = new Vector3(posix, 0.75f, posiz);
            posixs             = posix + 6;
            posizs             = posiz + 5;
            Firecount          = number[posixs, posizs];
            Firecount++;

            anotherScript.NewNumber(posixs, posizs, Firecount);
            //Debug.Log(posixs +","+posizs +"のfirecountは"+number[posixs, posizs]);
            if (Firecount == 1)
            {
                Instantiate(target, transform.position, transform.rotation);
                transform.position = new Vector3(Random.Range(-6, 3), 0.75f, Random.Range(1, 7));
                target.GetComponent <Renderer>().material = Fire1;
            }
            else if (Firecount == 2)
            {
                target.GetComponent <Renderer>().material = Fire2;
            }
            else if (Firecount == 3)
            {
                target.GetComponent <Renderer>().material = Fire3;
            }
        }

        if (createCount >= 2 && createCount <= 3)
        {
            Debug.Log("奥の処理を実行");
            posix3             = Random.Range(-6, 3);
            posiz3             = Random.Range(1, 7);
            transform.position = new Vector3(posix3, 0.75f, posiz3);
            posixs3            = posix3 + 6;
            posizs3            = posiz3 + 5;
            Firecount3         = number[posixs3, posizs3];
            Firecount3++;
            anotherScript.NewNumber(posixs3, posizs3, Firecount3);
            if (Firecount3 == 1)
            {
                Instantiate(target, transform.position, transform.rotation);
                transform.position = new Vector3(Random.Range(-6, 3), 0.75f, Random.Range(1, 7));
                target.GetComponent <Renderer>().material = Fire1;
            }
            else if (Firecount3 == 2)
            {
                target.GetComponent <Renderer>().material = Fire2;
            }
            else if (Firecount3 == 3)
            {
                target.GetComponent <Renderer>().material = Fire3;
            }
            if (createCount >= 4 && createCount <= 5)
            {
                posix2             = Random.Range(-6, 3);
                posiz2             = Random.Range(9, 15);
                transform.position = new Vector3(posix2, 0.75f, posiz2);
                posixs2            = posix2 + 6;
                posizs2            = posiz2 - 9;
                Firecount2         = number2[posixs2, posizs2];
                Firecount2++;
                anotherScript.NewNumber2(posixs2, posizs2, Firecount2);
                if (Firecount2 == 1)
                {
                    Instantiate(target, transform.position, transform.rotation);
                    transform.position = new Vector3(Random.Range(-6, 3), 0.75f, Random.Range(9, 15));
                    target.GetComponent <Renderer>().material = Fire1;
                }
                else if (Firecount2 == 2)
                {
                    target.GetComponent <Renderer>().material = Fire2;
                }
                else if (Firecount2 == 3)
                {
                    target.GetComponent <Renderer>().material = Fire3;
                }
            }
            if (createCount >= 6 && createCount <= 7)
            {
                posix4             = Random.Range(-6, 3);
                posiz4             = Random.Range(15, 21);
                transform.position = new Vector3(posix4, 0.75f, posiz4);
                posixs4            = posix4 + 6;
                posizs4            = posiz4 - 9;
                Firecount4         = number2[posixs4, posizs4];
                Firecount4++;
                anotherScript.NewNumber2(posixs4, posizs4, Firecount4);
                if (Firecount4 == 1)
                {
                    Instantiate(target, transform.position, transform.rotation);
                    transform.position = new Vector3(Random.Range(-6, 3), 0.75f, Random.Range(15, 21));
                    target.GetComponent <Renderer>().material = Fire1;
                }
                else if (Firecount4 == 2)
                {
                    target.GetComponent <Renderer>().material = Fire2;
                }
                else if (Firecount4 == 3)
                {
                    target.GetComponent <Renderer>().material = Fire3;
                }
            }
        }
    }