Skip to content
This repository has been archived by the owner on Sep 3, 2022. It is now read-only.

Reduce usage of object casting as it makes hard to refactor GameObjects #481

Open
moonshadow565 opened this issue Apr 29, 2017 · 2 comments
Labels
E-easy hacktoberfest I-cleanup No impact; the issue is one of maintainability or tidiness S-verified This issue has been verified
Projects

Comments

@moonshadow565
Copy link
Member

No description provided.

@MythicManiac MythicManiac added enhancement E-easy S-clarifying This issue needs clarification S-unverified This issue needs verification labels Oct 4, 2017
@MythicManiac
Copy link
Member

More details would be nice

@moonshadow565
Copy link
Member Author

moonshadow565 commented Oct 5, 2017

Instead of:

void ManagerUpdate()
{
foreach(var o in objects)
{
  if (o is Foo)
  {
    var foo = o as Foo;
    foo.internalMethod();
    //gazilion more casts and if else checks
  }
 //even more casts and checks
}
}

Prefered:

void MangerUpdate()
{
  foreach(var o in objects)
  {
    o.internalMethod(); //iternal method is almost allways virtual already anyways
  }
}

@MythicManiac MythicManiac added hacktoberfest S-verified This issue has been verified and removed S-clarifying This issue needs clarification S-unverified This issue needs verification enhancement labels Oct 5, 2017
@MatthewFrench MatthewFrench added this to To do in Development Aug 25, 2018
@Veykril Veykril added the I-cleanup No impact; the issue is one of maintainability or tidiness label Sep 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
E-easy hacktoberfest I-cleanup No impact; the issue is one of maintainability or tidiness S-verified This issue has been verified
Projects
Development
  
To do
Development

No branches or pull requests

3 participants