예제 #1
0
 public PlayerEntity(Vector3 Pos)
     : base(Pos, new AABB(1, 2, 1), 10)
 {
     _walkFrame = 0;
     _swingFrame = 0;
     _sword = OBJModelParser.GetInstance().Parse("res/mdl/sword");
 }
예제 #2
0
 static Enemy()
 {
     _mdl = OBJModelParser.GetInstance().Parse("res/mdl/enemy");
     _garbage = new Bitmap(1, 1);
     _garbageg = Graphics.FromImage(_garbage);
     List<Pair<string, Rect2D>> quotes = new List<Pair<string, Rect2D>>();
     using (StreamReader s = new StreamReader("res/screams.txt")) {
         while (!s.EndOfStream) {
             string q = s.ReadLine();
             while (q.EndsWith(@"\")) {
                 q = q.Substring(0, q.Length - 1);
                 q += "\n";
                 q += s.ReadLine();
             }
             SizeF size = _garbageg.MeasureString(q, SystemFonts.DefaultFont);
             Bitmap img = new Bitmap((int)size.Width + 6, (int)size.Height + 6);
             Graphics g = Graphics.FromImage(img);
             g.FillRectangle(Brushes.White, 0, 0, img.Width, img.Height);
             g.DrawString(q, SystemFonts.DefaultFont, Brushes.Black, 3, 3);
             g.Dispose();
             Pair<string, Rect2D> ins = new Pair<string, Rect2D>();
             ins.First = q;
             const int SCALE = 30;
             const int SCALE2 = 2 * SCALE;
             ins.Second = new Rect2D(img,
                     -(size.Width / SCALE2), -(size.Height / SCALE2),
                     (size.Width / SCALE), (size.Height / SCALE));
             quotes.Add(ins);
         }
     }
     _garbageg.Dispose();
     _garbageg = null; //Prevent accidental use.
     _quotes = quotes.ToArray();
     _r = new Random();
 }