Exemple #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);
            }
        }
Exemple #2
0
 void OnTriggerEnter(Collider coll)
 {
     CarCollCtl = coll.gameObject.GetComponent <CarCollisionController>();
     if (!CarCollCtl)
     {
         return;
     }
     CarCollCtl.HitItem();
     Hide("Box");
     Destroy(gameObject, duration);
 }
Exemple #3
0
        void OnDestroy()
        {
            if (CarCollCtl)
            {
                CarCollCtl.EnableCar(true);
            }

            if (itemMgr)
            {
                itemMgr.OnDefaultLaunch -= LaunchBackward;
            }
        }
Exemple #4
0
 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);
 }
Exemple #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;
            }
        }
Exemple #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();
                }
            }
        }
Exemple #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);
            }
        }