I welcome the thought of dropping the project this morning. I think that’s a good sign that I’m ready to move on.
I’m now cleaning up my code. I started with making everything a public variable because I wasn’t focused on practicing variable privacy. Now that I’m abandoning the project, I need to make up for code debt.
I could’ve created these variables and done the [SerializeField] as I was coding. But I think it’s fine to do as I did; I wanted to get started and didn’t want to think too much about how my variables.
If you’re following my progress from yesterday’s journal entry:
then you can follow my checklist.
…To be honest though by the time you’re looking at this journal entry it’ll probably be all filled out (except the nice-to-do stuff).
I really didn’t want to do something like the code below because it would take a lot of space
[SerializeField]
private float damage;
// ...
public float getDamage() {
return damage;
}
public void setDamage(float _damage) {
damage = _damage;
}
After some research, I found a workaround (also Visual Studio supports refactoring to make it easy lol)
[SerializeField]
private float damage;
public float Damage { get => damage; set => damage = value; }
It is so much cleaner.
Also, let me know if there are better solutions out there. I’m not confident this will make my code function the same without having variable privacy issues. So far it seems good.
Hm… though when I reference these fields I have to use PascalCase… That makes me unhappy as a Java developer but what do I know?
After research, I’ve found this is common C# standard. -cries-
…I’ll get used to it… eventually…
But also why are private variables camelCase?? Or should they also be PascalCase and I’m just not doing the standard properly?
My code is going to be so inconsistent… private variables are camelCase while variables from other scripts will be PascalCase…
It’s okay. Nobody will notice, right? I certainly won’t cause I rarely look back at my code…