コード例 #1
0
ファイル: HitBox.cs プロジェクト: jasonwrwilson/LD48
    public void OnTriggerEnter2D(Collider2D collision)
    {
        DeepCreature collidingCreature = collision.gameObject.GetComponent <DeepCreature>();

        if (collidingCreature != null && !collidingCreature.IsDead())
        {
            dude.TakeDamage(collidingCreature.GetAttack());
        }
    }
コード例 #2
0
    public void OnTriggerEnter2D(Collider2D collision)
    {
        DeepCreature creature = collision.gameObject.GetComponent <DeepCreature>();

        if (creature != null && !creature.IsDead())
        {
            creature.TakeDamage(attack);
            if (creature.IsDead())
            {
                dude.EarnBones(creature.GetBones());
            }
            KillProjectile();
        }

        DeepTile tile = collision.gameObject.GetComponent <DeepTile>();

        if (tile != null && !tile.isAir && !tile.isWater)
        {
            KillProjectile();
        }
    }