コード例 #1
0
    void OnTriggerEnter2D(Collider2D col)
    {
        EnemyController enemy = col.gameObject.GetComponentInParent <EnemyController>();

        switch (col.gameObject.tag)
        {
        case "enemy_body_collider":
            if (!enemy.IsDead())
            {
                HandlePlayerDeath(enemy);
            }
            break;

        case "koopa_side_collider":
            Koopa koopa = col.gameObject.GetComponentInParent <Koopa>();
            if (koopa.GetCanDamage())
            {
                goto case "enemy_body_collider";
            }


            koopa.ShellMove(gbase.GetSide(gameObject.transform, col.gameObject.transform, false));
            break;

        default:
            Jump(3f);
            enemy.SendMethod(string.Format("Handle{0}", enemy.enemyType.ToString()), enemy);
            break;
        }
    }