public bool Attack(int damage) { switch (ItemType) { case NPC_TYPE: { NPC npc = this.GetComponent <NPC>(); npc.ApplyAttack(damage); break; } case DOOR: case HIDDENDOOR: { DoorControl dc = this.GetComponent <DoorControl>(); dc.ApplyAttack(damage); break; } } return(true); }