Beispiel #1
0
        public Map(PhysicsEngine physicsEngine)
        {
            physicsEngine.AddItem(this);
            this.physicsEngine = physicsEngine;
            RequeredTicksToMove = 3;
            Position = new Coordinates();
            Content = new Dictionary<Coordinates, char>();
            for (int i = 0; i < mapFences.Length; i++)
            {
                mapFences[i] = new char[Globals.Y_MAX_BOARD_SIZE];
                for (int j = 0; j < mapFences[i].Length; j++)
                {
                    mapFences[i][j] = j % 3 == 1 ? Globals.BACKGROUND_DEFAULT_VALUE : '+';
                }
            }
            var jsonText = File.ReadAllText(Globals.MODELS_PATH + "asd" + Globals.MODELS_FILES_EXTENSION);
            var deserializeObject = JsonConvert.DeserializeObject<MapStructure>(jsonText);
            Width = deserializeObject.MapWidth;
            Height = deserializeObject.MapLength;
            foreach (var mapObject in deserializeObject.map)
            {

                switch (mapObject.ClassType)
                {
                    case "Services.Services.Objects.Obsticle":
                        TakeObject(obsticlesFactory, mapObject);
                        break;
                    default:
                        return;
                }
            }
            RecreateFences();
        }
Beispiel #2
0
 public GameLauncher(IMenu menuItm, IPaint ui, PhysicsEngine PhysicsEng)
 {
     menu = menuItm;
     UI = ui;
     ui.AddDrawableItem(menu);
     Physics = PhysicsEng;
     Initialise();
 }
Beispiel #3
0
 private Ui(PhysicsEngine physicsEngine)
 {
     this.physicsEngine = physicsEngine;
     drawables = new List<IDrawable>();
     UpdateScreen = true;
     for (var y = 0; y < Globals.Y_MAX_BOARD_SIZE; ++y)
     {
         view[y] = new char[Globals.X_MAX_BOARD_SIZE];
     }
     ClearView();
 }
Beispiel #4
0
 public static PhysicsEngine Instance()
 {
     if (instance == null)
     {
         lock (LockInstanceObj)
         {
             if (instance == null)
             {
                 instance = new PhysicsEngine();
             }
         }
     }
     return instance;
 }
Beispiel #5
0
 public static Ui Instance(PhysicsEngine physicsEngine)
 {
     if (instance == null)
     {
         lock (LockInstanceObj)
         {
             if (instance == null)
             {
                 instance = new Ui(physicsEngine);
             }
         }
     }
     return instance;
 }