示例#1
0
                         private void OpenState()
                         {
                             MyFader.GetComponent <Renderer>().enabled = true;

                             // Gets collider 2D
                             if (MyFader.GetComponent <Collider2D>())
                             {
                                 MyFader.GetComponent <Collider2D>().enabled = true;
                             }
                             // Or try to get collider 3D
                             else if (MyFader.GetComponent <Collider>())
                             {
                                 MyFader.GetComponent <Collider>().enabled = true;
                             }

                             IsOpen = true;
                         }
示例#2
0
                         private void CloseState()
                         {
                             FadeSpriteRenderer.color = Color.clear;
                             MyFader.GetComponent <Renderer>().enabled = false;

                             // Gets collider 2D
                             if (MyFader.GetComponent <Collider2D>())
                             {
                                 MyFader.GetComponent <Collider2D>().enabled = false;
                             }
                             // Or try to get collider 3D
                             else if (MyFader.GetComponent <Collider>())
                             {
                                 MyFader.GetComponent <Collider>().enabled = false;
                             }

                             IsOpen = false;
                         }