Exemplo n.º 1
0
    private void CollisionChecks(Collider2D collision)
    {
        if (!active)
        {
            return;
        }
        isBreaking = false;
        switch (collision.gameObject.layer)
        {
        case 17:     //collision with breakable object
            if (breakableTilemap == null)
            {
                breakableTilemap = collision.GetComponent <BreakableTilemap>();
            }
            breakableTilemap.BreakTile(transform.position);
            isBreaking = true;     //start breaking the tilemap
            break;

        case 9:     //collision with solid
            SetState(false);
            projectilePool.BurstParticles(transform.position);
            break;

        //collision with player
        case 8:
            if (collision.CompareTag("Player"))
            {
                //damage the player
                collision.GetComponent <IHealthObject>().Damage(1);
                //push the player
                pushing = collision.GetComponent <PhysicsObject>();
                pushing.InputVelocity = moveVelocity * pushForce;
                pushing.MoveVelocity  = Vector2.zero;
                pushing.Frozen        = true;
            }
            break;
        }
    }