Exemplo n.º 1
0
    protected new void OnTriggerEnter2D(Collider2D other)
    {
        base.OnTriggerEnter2D(other);

        string OtherTag = other.gameObject.tag;

        if ("PlayerCharacter" == OtherTag || "EnemyCharacter" == OtherTag)
        {
            if (Owner.GetInstanceID() != other.gameObject.GetInstanceID())
            {
                CBaseCharacter character = other.gameObject.GetComponent <CBaseCharacter>();
                character.Hit(Damage, Owner, HitMove, false, HitAniType);
                Destroy(gameObject);
            }
        }
        else if ("BreakBlock" == OtherTag)
        {
            CBreakBlock BreakBlock = other.gameObject.GetComponent <CBreakBlock>();
            BreakBlock.Hit(Damage);
            Destroy(gameObject);
        }
        else if ("RealTreasureChest" == OtherTag)
        {
            CRealTreasureChest RealTreasureChest = other.gameObject.GetComponent <CRealTreasureChest>();
            RealTreasureChest.Hit(Damage);
            Destroy(gameObject);
        }
        else if ("TrapTreasureChest" == OtherTag)
        {
            CTrapTreasureChest TrapTreasureChest = other.gameObject.GetComponent <CTrapTreasureChest>();
            TrapTreasureChest.Hit(Damage);
            Destroy(gameObject);
        }
    }
    private void OnTriggerEnter2D(Collider2D other)
    {
        string OtherTag = other.gameObject.tag;

        if (OtherTag == "PlayerCharacter" || OtherTag == "EnemyCharacter")
        {
            if (Owner.tag != OtherTag)
            {
                CBaseCharacter DamagedCharacter = other.gameObject.GetComponent <CBaseCharacter>();
                DamagedCharacter.Hit(Damage, Owner, HitMove, false, EHitAniType.Type1);
            }
        }
    }
Exemplo n.º 3
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        string tag = collision.gameObject.tag;

        if (tag == "PlayerCharacter" || tag == "EnemyCharacter")
        {
            CDebugLog.Log(ELogType.MapObject, "OnTriggerEnter2D CMovingTrap");

            CBaseCharacter character = collision.gameObject.GetComponent <CBaseCharacter>();
            if (character.curState == EState.Dodge || character.curState == EState.Die)
            {
                return;
            }

            character.Hit(Damage, gameObject, HitMove, false, EHitAniType.Type1);
        }
    }