Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. enum question

enum question

Scheduled Pinned Locked Moved C#
questiongame-devtutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Blubbo
    wrote on last edited by
    #1

    I'm sure I saw there was a documentation regarding to enum usage. I'm creating a game children that would involve a person that have enums of face, body, legs, feet, arms, hands. Each of those parts have unique values (i.e. face would have values of "round", "square", "oval"). I'm not quite sure on how to put those enums into "person" object. Can anyone point out the documentation? Thanks! (or should I use struct? or the other way?)

    P 1 Reply Last reply
    0
    • B Blubbo

      I'm sure I saw there was a documentation regarding to enum usage. I'm creating a game children that would involve a person that have enums of face, body, legs, feet, arms, hands. Each of those parts have unique values (i.e. face would have values of "round", "square", "oval"). I'm not quite sure on how to put those enums into "person" object. Can anyone point out the documentation? Thanks! (or should I use struct? or the other way?)

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      Something along the lines of:

      public enum FaceType { Round , ... }
      public enum FootType { Hairy , ... }

      public class Person
      {
      public FaceType Face { get ; private set ; }
      public FootType LeftFoot { get ; private set ; }
      public FootType RightFoot { get ; private set ; }

      ...
      }

      might work, but I'm unsure it would be best -- for one thing adding new attributes, like new face types, might be more difficult than necessary. You might consider have a config file or a database to store the types and values.

      B 1 Reply Last reply
      0
      • P PIEBALDconsult

        Something along the lines of:

        public enum FaceType { Round , ... }
        public enum FootType { Hairy , ... }

        public class Person
        {
        public FaceType Face { get ; private set ; }
        public FootType LeftFoot { get ; private set ; }
        public FootType RightFoot { get ; private set ; }

        ...
        }

        might work, but I'm unsure it would be best -- for one thing adding new attributes, like new face types, might be more difficult than necessary. You might consider have a config file or a database to store the types and values.

        B Offline
        B Offline
        Blubbo
        wrote on last edited by
        #3

        ahh I'll give that a shot! thanks!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups