Example #1
0
    private void HandleCollisions(GameObject other)
    {
        if (!HitedActive)
        {
            return;
        }

        bool doDamage = false;

        if (other.transform.name == "GamePlayerCollider")
        {
            GamePlayerCollision gamePlayerCollision =
                other.Get <GamePlayerCollision>();
            if (gamePlayerCollision != null)
            {
                if (gamePlayerController == null)
                {
                    return;
                }

                if (gamePlayerCollision.gamePlayerController == null)
                {
                    return;
                }

                if (gamePlayerCollision.gamePlayerController.uniqueId == gamePlayerController.uniqueId)
                {
                    return;
                }
                else
                {
                    doDamage = true;
                }
            }
        }

        if (other.tag != "Particle" && other.tag != "Player" &&
            other.tag != this.gameObject.tag)
        {
            doDamage = true;
        }

        if (doDamage)
        {
            if (!Explosive)
            {
                NormalDamage(other);
            }
            Active();
        }
    }
Example #2
0
    private void OnCollisionEnter(Collision collision)
    {
        if (HitedActive)
        {
            bool doDamage = false;

            if (collision.transform.name == "GamePlayerCollider")
            {
                GamePlayerCollision gamePlayerCollision =
                    collision.transform.gameObject.Get <GamePlayerCollision>();
                if (gamePlayerCollision != null)
                {
                    if (gamePlayerController == null)
                    {
                        return;
                    }

                    if (gamePlayerCollision.gamePlayerController == null)
                    {
                        return;
                    }

                    if (gamePlayerCollision.gamePlayerController.uniqueId == gamePlayerController.uniqueId)
                    {
                        return;
                    }
                    else
                    {
                        doDamage = true;
                    }
                }
            }

            if (collision.gameObject.tag != "Particle" && collision.gameObject.tag != "Player" &&
                collision.gameObject.tag != this.gameObject.tag)
            {
                doDamage = true;
            }

            if (doDamage)
            {
                if (!Explosive)
                {
                    NormalDamage(collision);
                }
                Active();
            }
        }
    }