I need your help with possessing pawns in my game.
I have two pawns in my game:
- the main player
- the pawn that will appear when certain key is pressed and gets destroyed after 5 seconds after it’s created.
I’ve added the possession code in my gamemode class, where I use TObjectIterator to iterate over my PaperCharacters I have - there are and there will be only two of them in my game.
I was wondering whether I could add some boolean setters and getters in my playercontroller class, but I can’ t understand how to overwrite the playercontroller in my player class (derives from APaperCharacter class) for example… or create some kind of class which hold the information about possessing.
I also wondered I could use somekind of PaperCharacter counter. Everytime when there are 2 PaperCharacters, the other character will be controlled and when there’ s 1 PaperCharacter, the player character will be controlled. However, it might use too much resource when it would have to count PaperCharacters every frame.
The real problem with this is that I don’ t know how to hold possession for 5 seconds before the created object gets destroyed.
I’ve trying to understand this logic for 1 day already. Don’ t know what to do… Thanks in advance!