Пример #1
0
 public ScoreComp(int prio, MonoEntity owner) : base(prio, owner, null)
 {
     if (instance == null || instance != this)
     {
         instance = this;
     }
     scoreText = "Your score: ";
     ResetScore();
 }
Пример #2
0
        public static void Reset()
        {
            comps         = new SortedDictionary <int, List <MonoComponent> >();
            renderComps   = new SortedDictionary <int, List <RenderComponent> >();
            colliderComps = new SortedDictionary <int, List <CircleCollider> >();
            MonoEntity    newGame     = new MonoEntity("ResetInstance");
            ResetListener resListener = new ResetListener(0, newGame);

            new ResetHandler(0, newGame);
            newGame.transform.position = new Vector2(200, 300);
        }
Пример #3
0
        public void Reset()
        {
            Image      img    = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "../../images/feelsgoodman.png");
            Image      img2   = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "../../images/feelsgoodman.png");
            MonoEntity entity = new MonoEntity("player");

            entity.transform.scale = Vector2.One * 100;
            new RenderComponent(20, entity, img);
            new CircleCollider(0, entity, img.Width / 2, new List <int>(1));
            new PlayerMovement(0, entity);
            MonoEntity mapEntity = new MonoEntity("map");

            new ObstacleSpawner(1, mapEntity);
            new RenderComponent(1, mapEntity, img2);
            MonoEntity scoreEnt = new MonoEntity("score");

            new ScoreComp(21, scoreEnt);
            Owner.RemoveComponent(this);
        }
Пример #4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Form1 form = new Form1();
            form.Show();
            form.Closed += (sender, args) => form.running = false;

            //Entities and Components
            Image img = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "../../images/feelsgoodman.png");
            MonoEntity entity = new MonoEntity("player");
            entity.transform.scale = Vector2.One * 100;
            new RenderComponent(20, entity, img);
            new CircleCollider(0, entity, img.Width / 2, new List<int>(1));
            new PlayerMovement(0, entity);
            MonoEntity mapEntity = new MonoEntity("map");
            new ObstacleSpawner(1, mapEntity);
            MonoEntity scoreEnt = new MonoEntity("score");
            new ScoreComp(21, scoreEnt);

            //Game loop
            form.RunGameLoop();
        }
Пример #5
0
 public CircleCollider(int prio, MonoEntity owner, float radius, List <int> colWithLayers) : base(prio, owner)
 {
     this.radius        = radius;
     this.colWithLayers = colWithLayers;
 }
Пример #6
0
 public ResetListener(int prio, MonoEntity owner) : base(prio, owner, null)
 {
 }
Пример #7
0
 public RenderComponent(int prio, MonoEntity owner, Image s) : base(prio, owner)
 {
     sprite = s;
 }