Beispiel #1
0
    private IEnumerator PlasticDelayMethod(float waitTime, GameObject col)
    {
        yield return(new WaitForSeconds(waitTime));

        if (col.gameObject)
        {
            PScript = col.GetComponent <PlasticBagMove>();
            PScript.PosZ_zero();
            PScript.PCahageMove();
        }
        else
        {
            Debug.Log("参照したGameObjectは消去されたため一部の実行を停止しました");
        }
    }
Beispiel #2
0
 private void OnTriggerEnter(Collider col)
 {
     if (col.gameObject.tag == "Trash" || col.gameObject.tag == "Plastic_cup")   //Trashに触れたら指定ポイントに再設置しY軸上昇
     {
         Tscript = col.gameObject.GetComponent <TrashMove>();
         Tscript.TrashChangeY(0.008f);
         Vector3 pos = col.gameObject.transform.position;
         col.gameObject.transform.position = new Vector3(pos.x, TrashSpawner.CopyPosY + 1.6f, pos.z); //2.1
     }
     if (col.gameObject.tag == "PlasticBag")                                                          //PlasticBagに触れたらY軸固定
     {
         Pscript = col.gameObject.GetComponent <PlasticBagMove>();
         Pscript.PlasticBagChangeX(0);
         Vector3 pos = col.gameObject.transform.position;
         col.gameObject.transform.position = new Vector3(pos.x, TrashSpawner.CopyPosY + 1.7f, pos.z);
     }
 }