![]() ![]() If you aim for more complex code and behaviours it's important to gain basic knowledge of your preferred language. That's all absolute fundamental knowledge in object-oriented-programming. That way you have 3 different classes but all have also a common type: the base class. The own classtype and the type of the base class. ![]() But if a class inherits from a base class the new class have 2 types. To access such a class you need to know the exact type of the class. I'm not 100% sure if that works in JS (i don't use this "dirty" language ) but it definitely work in C#Įvery class have it's own type and typename. The second code block shows how you should design your 3 classes and the base class of course.Īs far as i know you can use GetComponent(BaseClassName) to get even scripts that are inherited from this base class. Like FizixMan told you already in this >post<< If you have 3 scripts that are designed to do different things, but every script provide some similar variables or functions you should use class inheritance.Īll common variables and functions should be declared in the one base class. ![]() That sounds like you need a design pattern. There has to be a simpler way to do this though since I can't find any examples or tutorials that do anything like this anywhere. I figure by creating new game objects I could create 3 new game objects for each party slot, gut the GUI information from each of the previous character scripts and place them into 3 different object scripts and then add a character info and GUI scripts to each of the 3 new game objects, depending upon the player's selection though. ![]() Basically, I have 3 character scripts (for 3 separate player character's info/parameters), a manager script (for the update function) and an equations script (for almost all the functions) for a fight scenario similar to an (really) old school RPG.īy moving what I have into game objects I want to be able to allow the player to have any assortment of the 3 characters via some sort of selection in game. Anyways, I want to try to move it into unity using game objects and provide different functionality but I couldn't find tutorials with examples similar to what I'm trying to do. It could probably run in any JS compiler if there were similar GUI classes. I made a little GUI based game when I was learning how to use JS but as it is it doesn't utilize unity at all. I haven't tried doing it by making new game objects yet but this is what I'm trying to do ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |