show some c conventions for combining parent and child method outputs?

Looks fine to me. Although you should probably either rename it to GetTargetTypes() or make it a property:

public abstract class CharacterController : MonoBehaviour, ICharacter
{
    public virtual TargetTypes TargetTypes => TargetTypes.Character;
}

public class PlayerController : CharacterController, IPlayer
{
    public override TargetTypes TargetTypes => base.TargetTypes | TargetTypes.Player;
}

Note: You might need to use the fully qualified name to prevent confusion between the enum name and the member name, if you give them the same name (which is a common practice.)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top