In the first example, you’re missing the point of an interface. You wouldn’t use it to get a reference to your player. You would use it to update the variable.
It’s not about efficiency. If you make a separate interface for every player update, or just reach in and start tweaking variables, it doesn’t matter in terms of efficiency. The crucial point is ‘loose coupling’
Interfaces mean you can talk to actors without knowing what class they are. So your first example would become

What’s the point of that, you might ask!? ![]()
It has two very useful aspects:
-
You can make that call on ANY actor, so it becomes a general purpose call. Not very useful here, but if the call was something more like ‘Use’, you could image how many things that would work for ( door, gun, lift, teleporter… ), and they all implement ‘Use’ differently.
-
You’re making the call on the player without casting, and knowing what kind of actor class the player is. That’s called ‘decoupling’. It means that if, for instance, you talk to all your weapons using interfaces, your game will only ever load the gun ( and textures etc ) the player is using. If you use cast, the player will have the code and materials of all guns loaded all the time, even though they aren’t being used.
Hope that makes some sense…
PS: If you need to set a lot of player variables, you can still use an interface, but you would probably pass a structure.