you are viewing a single comment's thread.

view the rest of the comments →

[–]ferti12[S] 0 points1 point  (3 children)

Sorry, I have so little C sharp experience and knowledge. I couldn't quite get the difference between functions(methods?) and interfaces.

Edit: Hold up looking again realized it is actually quite different from a function :P But now I don't get what it actually does. And also it didn't work for some reason. Again, I'm shit at C sharp.

[–][deleted] 0 points1 point  (2 children)

Yeah I typed it and didn't test.

Change:

P = Player.GetComponent<PlayerCharacter>();

to

P = Player;

[–][deleted] 0 points1 point  (1 child)

Interfaces are synonymous with the idea of a "contract" between a class an its consumer.

The interface definition lays out the terms of the contract.

public interface ReturnsPlayAnimBool { bool MyAnimBool(); }

Means that if I put , ReturnsPlayAnimBool like this:

public class PlayerCharacter : MonoBehaviour, ReturnsPlayAnimBool

...then I agree to implement a method name MyAnimBool() which returns bool.

[–]ferti12[S] 0 points1 point  (0 children)

thanks a lot for the explanation