Exemple #1
0
    public override void OnTriggerEnter2D(Collider2D other)
    {
        //RETURN CONDITIONS
        if (other.tag == "Wall")
        {
            if (explodeOnHit)
            {
                Explode();
                return;
            }
            return;
        }

        Base_Health otherHealth = other.GetComponent <Base_Health> ();

        if (otherHealth == null || otherHealth.GetPlayerTag().Id == id || (otherHealth.GetPlayerTag().Team != 0 && otherHealth.GetPlayerTag().Team == team))
        {
            return;
        }

        if (canStun)
        {
            otherHealth.AddStun();
        }
        DamageTarget(otherHealth);
        // ELSE CASE??

        if (explodeOnHit)
        {
            Explode();
            return;
        }
    }
Exemple #2
0
    public virtual void OnTriggerEnter2D(Collider2D other)
    {
        //RETURN CONDITIONS
        if (other.tag == "Wall")
        {
            if (deathParticlePrefab != null)
            {
                Instantiate(deathParticlePrefab, transform.position, transform.rotation);
            }
            if (destroyOnHit)
            {
                Destroy(gameObject);
                return;
            }
            return;
        }
        Base_Health otherHealth = other.GetComponent <Base_Health> ();

        if (otherHealth == null || otherHealth.GetPlayerTag().Id == id || (otherHealth.GetPlayerTag().Team != 0 && otherHealth.GetPlayerTag().Team == team))
        {
            return;
        }

        if (canStun)
        {
            otherHealth.AddStun();
        }

        DamageTarget(otherHealth);
        // ELSE CASE??
    }
Exemple #3
0
    public override void OnTriggerEnter2D(Collider2D other)
    {
        Base_Health otherHealth = other.GetComponent <Base_Health> ();

        if (otherHealth == null || otherHealth.GetPlayerTag().Id == id || (otherHealth.GetPlayerTag().Team != 0 && otherHealth.GetPlayerTag().Team == team))
        {
            return;
        }

        if (swim)
        {
            Pirahna_Bullet[] bullets = FindObjectsOfType <Pirahna_Bullet> ();
            foreach (Pirahna_Bullet bullet in bullets)
            {
                bullet.ResetKillFlag(Base_Health.KILL_FLAGS.PIRAHNA);
                Rigidbody2D oBody = bullet.GetComponent <Rigidbody2D> ();
                oBody.velocity            = Vector3.Normalize(other.transform.position - bullet.transform.position) * move_speed * 5f;
                bullet.transform.rotation = Quaternion.Euler(new Vector3(0f, 0f, Mathf.Atan2(oBody.velocity.y, oBody.velocity.x)));
                bullet.swim = false;
            }
            killFlag = Base_Health.KILL_FLAGS.NONE;
        }


        if (canStun)
        {
            otherHealth.AddStun();
        }

        DamageTarget(otherHealth);



        //RETURN CONDITIONS

        /*
         * if (other.tag == "Wall") {
         *      if (deathParticlePrefab != null)
         *              Instantiate (deathParticlePrefab, transform.position, Quaternion.identity);
         *      if (destroyOnHit) {
         *              Destroy (gameObject);
         *              return;
         *      }
         *      return;
         * }
         */
        // ELSE CASE??
    }
Exemple #4
0
    public override void OnTriggerEnter2D(Collider2D other)
    {
        //RETURN CONDITIONS
        if (excludeObjects.Contains(other.gameObject))
        {
            return;
        }

        Base_Health otherHealth = other.GetComponent <Base_Health> ();

        if (otherHealth == null || (otherHealth.GetPlayerTag().Team != 0 && otherHealth.GetPlayerTag().Team == team))
        {
            return;
        }

        if (canStun)
        {
            otherHealth.AddStun();
        }

        DamageTarget(otherHealth);
        // ELSE CASE??
    }