Ejemplo n.º 1
0
    /// <summary>
    /// When a collision with particle effects has been found.
    /// Check if it is an enemy then apply damage.
    /// </summary>
    /// <param name="sender">The collision sender.</param>
    /// <param name="e">The RFX script e.</param>
    private void CollisionEnter(object sender, RFX4_PhysicsMotion.RFX4_CollisionInfo e)
    {
        if (!hit && collisionDamage)
        {
            hit = true;
            if (e.HitGameObject.tag == "Enemy")
            {
                Enemy enemy = e.HitGameObject.transform.GetComponent <Enemy>();

                if (enemy)
                {
                    StartCoroutine(Damage(timetilldamage));
                }
            }
            else
            {
                if (e.HitGameObject.transform.root.tag == "Enemy")
                {
                    Enemy enemy = e.HitGameObject.transform.root.GetComponent <Enemy>();

                    if (enemy)
                    {
                        StartCoroutine(Damage(timetilldamage));
                    }
                }
            }

            Debug.Log("hit - " + name);
        }
    }
Ejemplo n.º 2
0
    private void CollisionEnter(object sender, RFX4_PhysicsMotion.RFX4_CollisionInfo e)
    {
        Debug.Log(e.HitGameObject.name);
        var enemy = e.HitGameObject.GetComponent <Enemy>();

        if (enemy != null)
        {
            Debug.Log("deydi moruk");
            GameController.AttackToEnemy(enemy);
            Destroy(gameObject);
        }
    }
 //collision by RFX4 package
 private void CollisionEnter(object sender, RFX4_PhysicsMotion.RFX4_CollisionInfo e)
 {
     if (bounces > 0)
     {
         if (actualBounces < bounces)
         {
             // is an bouncing bullet, check if is the last bouncing or must keep bouncing
             ((RFX4_PhysicsMotion)sender).canExplode = false;
         }
         else
         {
             // the RFX4 can explode the bullet, is not bouncing anymore
             ((RFX4_PhysicsMotion)sender).canExplode = true;
         }
     }
     else
     {
         ((RFX4_PhysicsMotion)sender).canExplode = true;
     }
     Collide(e.HitGameObject, e.Collision);
 }
Ejemplo n.º 4
0
 private void CollisionEnter(object sender, RFX4_PhysicsMotion.RFX4_CollisionInfo e)
 {
     Debug.Log(e.HitPoint);           //a collision coordinates in world space
     Debug.Log(e.HitGameObject.name); //a collided gameobject
     Debug.Log(e.HitCollider.name);   //a collided collider :)
 }
Ejemplo n.º 5
0
 private void CollisionEnter(object sender, RFX4_PhysicsMotion.RFX4_CollisionInfo e)
 {
 }