Ejemplo n.º 1
0
 public virtual void Move(asd.Vector2DI dir)
 {
     if (CanMove(Position + dir))
     {
         Position += dir;
     }
 }
Ejemplo n.º 2
0
            public void Update()
            {
                var pos = new asd.Vector2DF(
                    (int)(Parent.Position.X / Consts.CharSize.X) * Consts.CharSize.X,
                    (int)(Parent.Position.Y / Consts.CharSize.Y) * Consts.CharSize.Y);

                var size = new asd.Vector2DI();

                foreach (var chara in Charas)
                {
                    size.X = Math.Max(size.X, chara.Key.Item1);
                    size.Y = Math.Max(size.Y, chara.Key.Item2);
                }
                pos -= new asd.Vector2DF(
                    Consts.CharSize.X * size.X,
                    Consts.CharSize.Y * size.Y) / 2;
                pos += Position;

                foreach (var c in Charas)
                {
                    c.Value.Position = new asd.Vector2DF(
                        pos.X + c.Key.Item1 * Consts.CharSize.X,
                        pos.Y + c.Key.Item2 * Consts.CharSize.Y
                        );
                }
            }
Ejemplo n.º 3
0
 public Button(string text, float x, float y, int fontsize, asd.Color color)
 {
     font           = asd.Engine.Graphics.CreateDynamicFont(string.Empty, fontsize, color, 1, new asd.Color(255, 255, 255, 255));
     Font           = font;
     size           = font.CalcTextureSize(text, asd.WritingDirection.Horizontal);
     CenterPosition = new asd.Vector2DF(size.X / 2.0f, size.Y / 2.0f);
     Position       = new asd.Vector2DF(x, y);
     Text           = text;
 }
Ejemplo n.º 4
0
 public virtual bool CanMove(asd.Vector2DI pos)
 {
     if (pos.X > 0 && pos.Y > 0 && pos.X < RoomIn.Width && pos.Y < RoomIn.Height)
     {
         if (RoomIn.GetBlock(pos).Wall)
         {
             return(false);
         }
         return(true);
     }
     return(false);
 }
Ejemplo n.º 5
0
        protected override void OnDraw(asd.RenderTexture2D dst, asd.RenderTexture2D src)
        {
            Material2d.SetFloat("g_second", second);
            second += asd.Engine.DeltaTime;

            var wsi = asd.Engine.WindowSize;

            if (_lastWindowSize != wsi)
            {
                _lastWindowSize = wsi;
                var ws = wsi.To2DF();
                Material2d.SetVector2DF("g_resolution", ws / Math.Min(ws.X, ws.Y));
                Material2d.SetVector2DF("g_size", ws);
            }

            Material2d.SetTexture2D("g_texture", src);

            DrawOnTexture2DWithMaterial(dst, Material2d);

            OnDrawEvent();
        }
Ejemplo n.º 6
0
 public Block GetBlock(asd.Vector2DI pos)
 {
     return(Blocks[pos.X, pos.Y]);
 }
Ejemplo n.º 7
0
 public virtual void AddToRoom(Room room, asd.Vector2DI pos)
 {
     Room     = room;
     Position = pos;
     Pressed  = false;
 }