Petr
Petr
CC#
Created by Petr on 12/1/2022 in #help
❔ Variables from different classes not adding up 2
Yeah i do, of course, i'm on school break.
36 replies
CC#
Created by Petr on 12/1/2022 in #help
❔ Variables from different classes not adding up 2
Thats exactly what i want. Sadly multiple inheritance isn't supported in c#, so i have to found another way. Yes that sounds very good actually, it would simplify the code a lot. I'm not ready to use enums yet (not sure how they work). But yes, player (YourCharacter) is supposed to be a combination of Race and Class, in terms of stats and functions. And even though im referencing the classes and creating objects of all races, Race's variables and functions aren't visible, and i know i've done it wrong.
36 replies
CC#
Created by Petr on 12/1/2022 in #help
❔ Variables from different classes not adding up 2
Actually, i have one more question. VasePostava (YourCharacter) should be combination of Rasa (Race/Specie) and Povolani (Class, as warrior, mage...) So in this snippet, i tried to make YourCharacters stats equal to the stats of chosen Race. I would like to then make that stat
+=
+=
with the Class (warrior etc.) stats. So YourCharacter would be combination of Class and Race. Does that still work with your solution, or do i need to adjust something else? Thanks.
36 replies
CC#
Created by Petr on 12/1/2022 in #help
❔ Variables from different classes not adding up 2
Thanks for the advice, this is my very first c# project, so im just figuring things out. I'll try to follow your advice to make everything work properly. Thank you:)
36 replies
CC#
Created by Petr on 11/30/2022 in #help
✅ Variables from different classes not adding up
Okay, it would be like a bad habit to do it through static variables. Ill change it to non-static and try it again
10 replies
CC#
Created by Petr on 11/30/2022 in #help
✅ Variables from different classes not adding up
Understood, basically it means that static variable cannot be used in this manner and it needs to be non - static and belong to a created object, right? ill try that, thank you very much!
10 replies
CC#
Created by Petr on 11/30/2022 in #help
✅ Variables from different classes not adding up
I think i understand a little bit. Since hodnotaBrneni is part of Latkova, and is a static variable, i thought that i dont need to create an instance of Latkova object, since the variable belongs to the class itself, if you know what i mean. Is there any solution? Thanks for hearing me out.
10 replies