- Home /
Question is not direct and on point.
Character development with abilities
Hi, so I've been developing a game with different characters, I've created some of them and the menu and everything. What I've been doing currently is having a parent collider and setting meshes active based on their order in the children. When creating abilities I just added to this big class and changed stats with a case select. I feel like this isn't a good approach though and it's been bugging me. What I think would be good is to have a base object with basic movement and base abilities that all characters have. Then have another thing that is added on for special abilities and modifying the stats of the basic ones. I've heard a bit about scriptable objects and enums but really I'm just a beginner so if anyone could point me in the right direction that would appreciated. Thanks!
Answer by nathanthesnooper · Dec 20, 2016 at 07:41 PM
It's a bit confusing looking at your question, but it looks like you are going in the right direction. :) I would agree to make a class with all your information, but I would recommend only using integers. In the future, you will want some sort of anti-cheat and 'serialize' the class so nobody can edit it. You can only do this with strings, floats, and integers. For defaults, I would recommend setting the class to have a placeholder. something like this would work.
public class playerInformation { int Health = 10; }
Enums are also VERY simple to set up and very useful. You can read the docs here
However, I would recommend putting it outside of a class and making it public, so you can use it anywhere. The basic setup is public enum Direction {North, East, South, West};
but you could do something like public enum CharacterType {$$anonymous$$elee, Summoner, Ranged};
and somewhere you could do playerInformation.type = CharacterType.Summoner
, etc
Follow this Question
Related Questions
Character Selection (Change Material) 0 Answers
Allowing multiple selections on drop list via script inside inspector. 0 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Character Selection 0 Answers