Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
 void OnTriggerEnter(Collider coll)
 {
     CarCollCtl = coll.gameObject.GetComponent <CarCollisionController>();
     if (!CarCollCtl)
     {
         return;
     }
     CarCollCtl.HitItem();
     Hide("Box");
     Destroy(gameObject, duration);
 }
Exemplo n.º 3
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);
 }
Exemplo n.º 4
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();
                }
            }
        }
Exemplo n.º 5
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);
            }
        }