예제 #1
0
        void OnCollisionEnter(Collision coll)
        {
            if (coll.gameObject.tag == "Player" || coll.gameObject.tag == "Enemy")
            {
                CarCollCtl = coll.gameObject.GetComponent <CarCollisionController>();
                if (!CarCollCtl)
                {
                    return;
                }
                CarCollCtl.HitItem();

                Hide("Sphere");
                Destroy(gameObject, duration);
                return;
            }

            if (coll.gameObject.tag == "LaunchableItem")
            {
                Destroy(coll.gameObject);
                Destroy(gameObject);
            }

            if (coll.collider.CompareTag("Wall") && isLaunch)
            {
                ShowParticles();
                Destroy(gameObject);
            }
        }
예제 #2
0
 void OnTriggerEnter(Collider coll)
 {
     CarCollCtl = coll.gameObject.GetComponent <CarCollisionController>();
     if (!CarCollCtl)
     {
         return;
     }
     CarCollCtl.HitItem();
     Hide("Box");
     Destroy(gameObject, duration);
 }
예제 #3
0
        void OnDestroy()
        {
            if (CarCollCtl)
            {
                CarCollCtl.EnableCar(true);
            }

            if (itemMgr)
            {
                itemMgr.OnDefaultLaunch -= LaunchBackward;
            }
        }
예제 #4
0
파일: Banana.cs 프로젝트: jcondek/MarioCat
 void OnTriggerEnter(Collider coll)
 {
     CarCollCtl = coll.gameObject.GetComponent <CarCollisionController>();
     if (!CarCollCtl)
     {
         return;
     }
     CarCollCtl.HitItem();
     target = coll.gameObject.transform.root.gameObject;
     Hide("Capsule");
     Destroy(gameObject, duration);
 }
예제 #5
0
        void OnDestroy()
        {
            TripleRedShell parent = transform.root.gameObject.GetComponent <TripleRedShell>();

            if (parent)
            {
                parent.Children.Remove(gameObject.GetComponent <RedShell>());
            }

            if (CarCollCtl)
            {
                CarCollCtl.EnableCar(true);
            }
            if (itemMgr)
            {
                itemMgr.OnDefaultLaunch -= LaunchForward;
            }
        }
예제 #6
0
        void OnCollisionEnter(Collision coll)
        {
            if (coll.gameObject.tag == "Player" || coll.gameObject.tag == "Enemy")
            {
                CarCollCtl = coll.gameObject.GetComponent <CarCollisionController>();
                if (!CarCollCtl)
                {
                    return;
                }
                CarCollCtl.HitItem();
                ShowParticles();
                Hide("Sphere");
                Destroy(gameObject, duration);
            }

            if (coll.gameObject.tag == "LaunchableItem")
            {
                ShowParticles();
                Destroy(coll.gameObject);
                Destroy(gameObject);
            }

            if (coll.collider.CompareTag("Wall") && isLaunch)
            {
                Debug.Log(transform.eulerAngles);
                foreach (ContactPoint contact in coll.contacts)
                {
                    Vector3 reflectDir = Vector3.Reflect(transform.forward, contact.normal);
                    transform.LookAt(reflectDir + transform.position);
                }

                rebound += 1;
                if (rebound >= maxRebound)
                {
                    ShowParticles();
                    Destroy(gameObject);
                }
                else
                {
                    GetComponent <AudioSource>().Play();
                }
            }
        }
예제 #7
0
        void OnTriggerEnter(Collider coll)
        {
            if (coll.gameObject.tag == "EnemyCollider")
            {
                TripleRedShell parent = transform.root.gameObject.GetComponent <TripleRedShell>();
                if (parent)
                {
                    parent.Children.Remove(gameObject.GetComponent <RedShell>());
                }
                CarCollCtl = coll.gameObject.GetComponent <CarCollisionController>();
                CarCollCtl.HitItem();
                ShowParticles();
                Hide("Sphere");
                Destroy(gameObject, duration);
            }

            if (coll.gameObject.tag == "LaunchableItem")
            {
                ShowParticles();
                Destroy(coll.gameObject);
                Destroy(gameObject);
            }
        }