コード例 #1
0
    public override void Update()
    {
        int m = Keys.LeftShift.IsDown() ? 50 : 1;

        entity.Position += new Vector2(
            Keys.A.IsDown() ? -1 : Keys.D.IsDown() ?  1 : 0,
            Keys.W.IsDown() ?  1 : Keys.S.IsDown() ? -1 : 0
            ) * Core.lastDT * 50f * m;

        entity.Rotation += Keys.Q.IsDown() ? 0.025f : Keys.E.IsDown() ? -0.025f : 0;



        if (Input.LMB.WasPressed())
        {
            for (int i = 0; i < 1; i++)
            {
//                var newEnt = new Entity(entity.Position);// + new Vector2(r.Next(-10,10)/10f, r.Next(-10,10)/10f));
//                newEnt.Direction = entity.Position-Core.mainCam.WorldMousePosition;
//                newEnt.AddComponent(new Projectile());
                //newEnt.AddComponent(new Sprite(new SpriteData(Color.PaleVioletRed)));
//                newEnt.AddComponent(new Quad(new QuadData(Sheet.Get(Sheet.ID.Obj_crate12), new Vector2(1,1), true)));
            }
        }



        if (Keys.Z.WasPressed())
        {
            entity.Position += Vector2.UnitX * 40;
        }
        if (Keys.Z.WasReleased())
        {
            entity.Position += Vector2.UnitX * -40;
        }


        //Entity.KeepOriginForPosition(entity.Position);


        Dbg.AddDebugLine(entity.Position, Core.mainCam.WorldMousePosition, Color.Red);
        Dbg.AddDebugLine(entity.Position, entity.Position + entity.Direction, Color.White);
        Dbg.AddDebugText("PLAYER", entity.Position, Color.Green);
    }
コード例 #2
0
    public void DrawDebug()
    {
        foreach (KeyValuePair <Point, List <T> > chunk in chunks_)
        {
            var pos  = chunk.Key;
            var comp = chunk.Value;

            //draw region square
            var regionRect = new Rectangle(pos.X * CHUNK_SIZE, pos.Y * CHUNK_SIZE, CHUNK_SIZE, CHUNK_SIZE);
            Dbg.AddDebugRect(regionRect, debugColor, Randy.NextFloat(0.25f));

            Dbg.AddDebugText(comp.Count.ToString(), regionRect.Location.ToVector2(), debugColor);

            for (var index = 0; index < comp.Count; index++)
            {
                T component = comp[index];
                //DebugHelper.AddDebugText(index.ToString(), component.entity.Position, debugColor);
            }
        }
    }
コード例 #3
0
 public override void Update()
 {
     Dbg.AddDebugText(name, entity.Position, Color.White);
 }