Beispiel #1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "goal")
        {
            if (checkpointflag)
            {
                //Debug.Log(moveList.Count);
                //Debug.Log(moveObjList.Count);

                /*
                 * goal = (GameObject)Resources.Load("clear");
                 * Vector3 postion = new Vector3(x: -5.5F, y: 0F, z: -5F);
                 * goal = Instantiate(goal, postion, Quaternion.identity);
                 */
                pauseScript.DispGoal(goalSprite);
                StartCoroutine(WaiTtime(2));
            }
            else
            {
                pauseScript.DispGoal(throwSprite);
            }
        }

        if (other.gameObject.tag == "checkpoint" && !checkpointflag && stage == "stage1")
        {
            checkpointflag = true;
            ifCheckFlg     = true;
            pauseScript.dispCheckPoint(checkPointSprite);
        }
        else if (other.gameObject.tag == "checkpoint" && stage == "stage2")
        {
            checkpointflag = true;
        }
        else if (other.gameObject.tag == "checkpoint1" && !checkpointflag && stage == "stage3")
        {
            stage3check1 = true;
            Debug.Log("checkpoint1 : true");
        }
        else if (other.gameObject.tag == "checkpoint2" && !checkpointflag && stage == "stage3")
        {
            stage3check2 = true;
            Debug.Log("checkpoint2 : true");
        }
        else if (other.gameObject.tag == "checkpoint3" && !checkpointflag && stage == "stage3")
        {
            stage3check3 = true;
            Debug.Log("checkpoint3 : true");
        }

        if (stage3check1 && stage3check2 && stage3check3)
        {
            checkpointflag = true;
        }

        //stg3 スタート地点/ゴール地点の切り替え
        if (other.gameObject.tag == "switching" && switching == false)
        {
            goalobj = (GameObject)Resources.Load("goal");
            Vector3 goalpos = new Vector3(-9.8f, -6.5f, -2f);
            goalobj      = Instantiate(goalobj, goalpos, Quaternion.identity);
            goalobj.name = "goal";
            switching    = true;
        }

        if (other.tag == "floar")
        {
            floarController.ChangeMaterial(other.transform.parent.gameObject);
        }
        if (other.gameObject.tag == "dog")
        {
            //awa.PlayOneShot(awa.clip);
            miss = (GameObject)Resources.Load("dogAtack");
            Vector3 postion = new Vector3(x: 0F, y: 0.5F, z: -5F);
            miss = Instantiate(miss, postion, Quaternion.identity);
        }

        if (other.gameObject.tag == "dog2")
        {
            miss = (GameObject)Resources.Load("accident2");
            Vector3 pos = new Vector3(0f, 0.5f, -6.594f);
            miss = Instantiate(miss, pos, Quaternion.identity);
        }
    }