public Decoration(Vector3 location, Vector3 scale, bool existsIn2d, bool existsIn3d, ObjMesh mesh, MeshTexture texture) : base() { _location = location; _scale = scale; _existsIn3d = existsIn3d; _existsIn2d = existsIn2d; _mesh = mesh; _texture = texture; _sprite = sprite; _cycleNum = 0; _frameNum = 0; _is3dGeo = true; _hascbox = false; _animDirection = 1; }
public Obstacle(Vector3 location, Vector3 scale, Vector3 pbox, bool existsIn2d, bool existsIn3d, bool collidesIn2d, bool collidesIn3d, ObjMesh mesh, MeshTexture texture) : base() { _location = location; _scale = scale; _pbox = pbox; _existsIn3d = existsIn3d; _existsIn2d = existsIn2d; _mesh = mesh; _texture = texture; _sprite = null; _cycleNum = 0; _frameNum = 0; _frame3d = 0; _is3dGeo = true; _hascbox = false; canSquish = false; _collidesIn2d = collidesIn2d; _collidesIn3d = collidesIn3d; _animDirection = 1; }
public Enemy(Player player, Vector3 location, Vector3 scale, Vector3 pbox, Vector3 cbox, bool existsIn2d, bool existsIn3d, int health, int damage, float speed, int AItype, ObjMesh mesh, MeshTexture texture, Effect death) : base() { _location = location; _scale = scale; _pbox = pbox; _cbox = cbox; _existsIn3d = existsIn3d; _existsIn2d = existsIn2d; _health = health; _damage = damage; _speed = speed; _alive = true; this.AItype = AItype; _hascbox = true; _type = 1; frozen = false; maxFreezeTime = 0.7; freezetimer = 0; attackspeed = 1; attacktimer = 0; this.player = player; _deathAnim = death; _mesh = mesh; _texture = texture; _sprite = null; _cycleNum = 0; _frameNum = 0; _is3dGeo = true; _animDirection = 1; velocity = new Vector3(0, 0, 0); accel = new Vector3(0, 0, 0); kbspeed = new Vector3(70, 100, 70); moving = false; doesGravity = true; CurrentAI = new Stack<Airoutine>(); InitilizeAI(); }
private Decoration ParseDecoration(string path, Vector3 loc) { Decoration dec = null; // Instantiate the list Assembly assembly = Assembly.GetExecutingAssembly(); XmlReaderSettings settings = new XmlReaderSettings(); settings.IgnoreComments = true; string _d_path = "U5Designs.Resources.Data.Decorations." + path; Stream fstream = assembly.GetManifestResourceStream(_d_path); XmlDocument doc = new XmlDocument(); XmlReader reader = XmlReader.Create(fstream, settings); doc.Load(reader); Vector3 scale = LoadLevel.parseVector3(doc.GetElementsByTagName("scale")[0]); bool _draw2 = Convert.ToBoolean(doc.GetElementsByTagName("draw2")[0].InnerText); bool _draw3 = Convert.ToBoolean(doc.GetElementsByTagName("draw3")[0].InnerText); // Check to see if the current Obstacle is 2D or 3D and handle accordingly if (Convert.ToBoolean(doc.GetElementsByTagName("is2d")[0].InnerText)) { // Create the SpriteSheet SpriteSheet ss = LoadLevel.parseSpriteFile(doc.GetElementsByTagName("sprite")[0].InnerText); Billboarding bb = Billboarding.Yes; //Have to put something here for it to compile switch (doc.GetElementsByTagName("billboards")[0].InnerText) { case "yes": case "Yes": bb = Billboarding.Yes; break; case "lock2d": case "Lock2d": bb = Billboarding.Lock2d; break; case "lock3d": case "Lock3d": bb = Billboarding.Lock3d; break; default: Console.WriteLine("Bad obstacle file: " + path); Environment.Exit(1); break; } dec = new Decoration(loc, scale, _draw2, _draw3, bb, ss); } else { XmlNodeList _m = doc.GetElementsByTagName("mesh"); ObjMesh _mesh = new ObjMesh(assembly.GetManifestResourceStream("U5Designs.Resources.Geometry." + _m.Item(0).InnerText)); XmlNodeList _b = doc.GetElementsByTagName("bmp"); List<Bitmap> texFrames = new List<Bitmap>(); foreach (XmlNode n in _b) { texFrames.Add(new Bitmap(assembly.GetManifestResourceStream("U5Designs.Resources.Textures." + n.InnerText))); } MeshTexture _bmp = new MeshTexture(texFrames); _bmp.init(); dec = new Decoration(loc, scale, _draw2, _draw3, _mesh, _bmp); } fstream.Close(); return dec; }
private Obstacle ParseObstacle(string path, Vector3 loc) { Obstacle o = null; Assembly assembly = Assembly.GetExecutingAssembly(); XmlReaderSettings settings = new XmlReaderSettings(); settings.IgnoreComments = true; XmlDocument doc = new XmlDocument(); string _o_path = "U5Designs.Resources.Data.Obstacles." + path; Stream fstream = assembly.GetManifestResourceStream(_o_path); XmlReader reader = XmlReader.Create(fstream, settings); doc.Load(reader); Vector3 scale = LoadLevel.parseVector3(doc.GetElementsByTagName("scale")[0]); Vector3 pbox = LoadLevel.parseVector3(doc.GetElementsByTagName("pbox")[0]); bool _draw2 = Convert.ToBoolean(doc.GetElementsByTagName("draw2")[0].InnerText); bool _draw3 = Convert.ToBoolean(doc.GetElementsByTagName("draw3")[0].InnerText); bool _collides2d = Convert.ToBoolean(doc.GetElementsByTagName("collidesIn2d")[0].InnerText); bool _collides3d = Convert.ToBoolean(doc.GetElementsByTagName("collidesIn3d")[0].InnerText); // Check to see if the current Obstacle is 2D or 3D and handle accordingly XmlNodeList _type = doc.GetElementsByTagName("is2d"); if (Convert.ToBoolean(_type.Item(0).InnerText)) { String ss_path = doc.GetElementsByTagName("sprite")[0].InnerText; fstream.Close(); SpriteSheet ss = LoadLevel.parseSpriteFile(ss_path); Billboarding bb = Billboarding.Yes; //Have to put something here for it to compile switch (doc.GetElementsByTagName("billboards")[0].InnerText) { case "yes": case "Yes": bb = Billboarding.Yes; break; case "lock2d": case "Lock2d": bb = Billboarding.Lock2d; break; case "lock3d": case "Lock3d": bb = Billboarding.Lock3d; break; default: Console.WriteLine("Bad obstacle file: " + path); Environment.Exit(1); break; } o = new Obstacle(loc, scale, pbox, _draw2, _draw3, _collides2d, _collides3d, bb, ss); } else { fstream.Close(); XmlNodeList _m = doc.GetElementsByTagName("mesh"); ObjMesh _mesh = new ObjMesh(assembly.GetManifestResourceStream("U5Designs.Resources.Geometry." + _m.Item(0).InnerText)); XmlNodeList _b = doc.GetElementsByTagName("bmp"); List<Bitmap> texFrames = new List<Bitmap>(); foreach (XmlNode n in _b) { texFrames.Add(new Bitmap(assembly.GetManifestResourceStream("U5Designs.Resources.Textures." + n.InnerText))); } MeshTexture _tex = new MeshTexture(texFrames); _tex.init(); o = new Obstacle(loc, scale, pbox, _draw2, _draw3, _collides2d, _collides3d, _mesh, _tex); fstream.Close(); } return o; }