Page 432 - MDP2022-3
P. 432

using  System.Collections;
             using  System.Collections.Generic;
             using  UnityEngine;
             public  class  Key4Action  :  MonoBehaviour
             {
                     public  List<GameObject>  portraitLightList  =  new  List<GameObject>();

                     public  bool  isPass  =  false;
                     public  bool  isPass_2  =  false;
                     public  bool  touchdoll  =  false;

                     public  GameObject  jingjing_1;
                     public  List<GameObject>  jingjing_23456  =  new  List<GameObject>();
                     public  bool  jingjing_1Touch  =  false;


                     private  void  OnTriggerEnter(Collider  other)
                     {
                             if  (other.tag  ==  "Player"  &&  !isPass)
                             {
                                     isPass  =  true;
                                     LightOn();
                                     Invoke("JingJingCry",  2f);
                             }


                             if  ((jingjing_1Touch  ||  touchdoll)  &&  !isPass_2)
                             {                        isPass_2  =  true;
                                     foreach  (var  item  in  jingjing_23456)
                                     {
                                             Destroy(jingjing_1);
                                             item.SetActive(true);
                                             item.GetComponent<AudioSource>().Play();
                                             StartCoroutine(DestroyJingJing2());
                                     }

                             }
                     }
                     public  void  LightOn()
                     {
                             foreach  (var  item  in  portraitLightList)
                             {
                                     item.SetActive(true);
                                     item.GetComponent<AudioSource>().Play();
                             }
                     }
   427   428   429   430   431   432   433   434   435   436   437