unitytips: Property Patterns
Property Patterns enables you to match on properties of the object examined in a Switch Expressions.
The switch expression provides for switch-like semantics in an expression context. It provides a concise syntax when the switch arms produce a value.
In this sample, we will calculate the damage that an NPC can cause taking into account if it is an enemy, and if it is armed.