Skip to main content
added 547 characters in body
Source Link
Blau
  • 3.4k
  • 17
  • 19

I want to know what kind of property I need to put inside the player class to handle where he is on the map

A point.

 public Point Location;

Or two coordinates:

 public int X,Y;

In other way, for the skills, I would use a Dictionary, is more versatile.

 Dictionary<SkillType, Skill> Skills;

 void InitializeSkills()
 {   
     foreach (var key in Enum.GetValues(typeof(SkillType)).Cast<SkillType>())
     {
         Skills.Add(key, new Skill()));
     }
 } 

This is equivalent to your players class skill definition area... I think that is not your final code, but it you need load skill definitions from xml is easier now to adapt the code, and create them programatically.

I want to know what kind of property I need to put inside the player class to handle where he is on the map

A point.

 public Point Location;

Or two coordinates:

 public int X,Y;

I want to know what kind of property I need to put inside the player class to handle where he is on the map

A point.

 public Point Location;

Or two coordinates:

 public int X,Y;

In other way, for the skills, I would use a Dictionary, is more versatile.

 Dictionary<SkillType, Skill> Skills;

 void InitializeSkills()
 {   
     foreach (var key in Enum.GetValues(typeof(SkillType)).Cast<SkillType>())
     {
         Skills.Add(key, new Skill()));
     }
 } 

This is equivalent to your players class skill definition area... I think that is not your final code, but it you need load skill definitions from xml is easier now to adapt the code, and create them programatically.

Source Link
Blau
  • 3.4k
  • 17
  • 19

I want to know what kind of property I need to put inside the player class to handle where he is on the map

A point.

 public Point Location;

Or two coordinates:

 public int X,Y;