Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Kolos_testowy
- {
- public enum CharClass
- {
- warrior,
- mage,
- archer
- }
- class Character
- {
- double posx;
- double posy;
- int level;
- string nick;
- CharClass charClass;
- //public readonly charClass CharClass;
- private Character(double posx, double posy, int level, string nick, CharClass charClass)
- {
- this.posx = posx;
- this.posy = posy;
- this.level = level;
- this.nick = nick;
- }
- public static Character generate(double posx, double posy, int level, string nick, CharClass charClass)
- {
- return new Character(posx, posy, level, nick, charClass);
- }
- public int Level
- {
- get
- {
- return level;
- }
- }
- public string Nick
- {
- get
- {
- return nick;
- }
- }
- }
- }
- ////////////////////////////////////////////////////////////////////////
- main
- //////////////////////////////////////////////////////////////////////////
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Kolos_testowy
- {
- class Program
- {
- static void Main(string[] args)
- {
- Character char1 = Character.generate(3, 1,1,"kasztan", CharClass.archer);
- Character char2 = Character.generate(1, 2, 2, "leszcz", CharClass.mage);
- Console.WriteLine(char1.Level);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement