public virtual void OnLevelFinished(iEntity finisher) { LevelFinished?.Invoke(this, new LevelFinishedArgs() { Finisher = finisher }); }
public void Update(iEntity obj) { Blab blab = (Blab)obj; this.Delete(blab); this.Create(blab); }
public void Update(iEntity obj) { User user = (User)obj; this.Delete(user); this.Create(user); }
/// <summary> /// Remove entity from scene /// </summary> /// <param name="entity">remove entity in scene</param> public void removeEntity(iEntity entity) { // if it exists in the list then remove it if (childNodes.Contains(entity)) { childNodes.Remove(entity); } }
/// <summary> /// Add entity to scene /// </summary> /// <param name="entity">Entity</param> public void addEntity(iEntity entity) { // if entity isnt in list then add it to list if (!childNodes.Contains(entity)) { // add to list so its in scene childNodes.Add(entity); } }
/// <summary> /// Add an entity to render list /// </summary> /// <param name="ent">The entity to add</param> public void addEntity(iEntity ent) { entityList.Add(ent); if (ent is ICameraSubject) { cameraMan.RequestCamera(ent); cameraMan.AddCameras(); } }
/// <summary> /// Spawns a UI iEntity /// </summary> /// <param name="UI">The UI to spawn</param> public void SpawnUI(iEntity UI) { sceneGraph.addEntity(UI); storeEntity.Add(UI); renderMan.addUI(UI); if (UI is IInteractiveUI) { MouseInput.Subscribe((IMouseInputObserver)UI); } }
public void Update() { foreach (IShape ent in collidableList) { if (!PotentialCollisions.Contains((iEntity)ent)) { iEntity tmp = (iEntity)ent; tmp.Transparency = 1f; } } CollisionPhases(); }
public void Delete(iEntity obj) { Blab blab = (Blab)obj; try { string sql = "DELETE FROM atsweeney.blabs WHERE blabs.sys_id = '" + blab.Id + "'"; MySqlCommand cmd = new MySqlCommand(sql, this.dcBlab); cmd.ExecuteNonQuery(); } catch (Exception ex) { throw new Exception(ex.ToString()); } }
public void Delete(iEntity obj) { User user = (User)obj; try { string sql = "DELETE FROM users WHERE users.email = '" + user.Email + "'"; MySqlCommand cmd = new MySqlCommand(sql, this.dcUser); cmd.ExecuteNonQuery(); } catch (Exception ex) { throw new Exception(ex.ToString()); } }
public void Start() { // Load the start screen startScreen = engine.LoadUI <Background>("home-screen", new Vector2(0, 0), "Font"); startScreen.DrawPriority = 0; startScreen.TextPosition = new Vector2(600, 600); startScreen.Text = "Find the artefact (key) throughout the level and deliver it to the patient to win."; Button2Players = engine.LoadUI <Button>("2player-button", new Vector2(200, 400)); Button2Players.OnClick += Button2Players_OnClick; Button3Players = engine.LoadUI <Button>("3player-button", new Vector2(700, 400)); Button3Players.OnClick += Button3Players_OnClick; Button4Players = engine.LoadUI <Button>("4player-button", new Vector2(1200, 400)); Button4Players.OnClick += Button4Players_OnClick; }
/// <summary> /// Loads a single iEntities resource into memory /// </summary> /// <param name="ent">The entity to load</param> public void LoadResource(iEntity ent) { ent.Texture = contentMan.Load <Texture2D>(ent.TextureString); if (ent.GetVertices().Count == 0) { ent.SetVertices(new List <Vector2>() { new Vector2(0, 0), new Vector2(ent.Texture.Width, 0), new Vector2(ent.Texture.Width, ent.Texture.Height), new Vector2(0, ent.Texture.Height) }); } if (!string.IsNullOrEmpty(ent.FontString)) { ent.Font = LoadFont(ent.FontString); } }
public iEntity ProcessFind(SqlCommand oCD, iEntity oEntity) { using (SqlConnection oCN = new SqlConnection()) { if (Conectar(oCN)) { oCD.Connection = oCN; SqlDataReader oDR = oCD.ExecuteReader(); if (oDR.Read()) { oEntity.Load(oDR); } oDR.Close(); Desconectar(oCN); } } return(oEntity); }
/// <summary> /// Spawn entity into scene /// </summary> /// <param name="entityInstance">Spawn Entity</param> /// public void Spawn(iEntity entityInstance) { if (!storeEntity.Contains(entityInstance)) { // Insert entity into scene sceneGraph.addEntity(entityInstance); storeEntity.Add(entityInstance); if (entityInstance is iCollidable) { collManager.AddCollidable(entityInstance); } renderMan.addEntity(entityInstance); } }
public void Create(iEntity obj) { User user = (User)obj; try { DateTime now = DateTime.Now; string sql = "INSERT INTO users (sys_id, email, dttm_registration, dttm_last_login) VALUES ('" + user.Id + "', '" + user.Email + "', '" + now.ToString("yyyy-MM-dd HH:mm:ss") + "', '" + now.ToString("yyyy-MM-dd HH:mm:ss") + "')"; MySqlCommand cmd = new MySqlCommand(sql, this.dcUser); cmd.ExecuteNonQuery(); } catch (Exception ex) { throw new Exception(ex.ToString()); } }
private void NarrowPhase(IShape col1, IShape col2) { //Get list of each shapes vertices List <Vector2> shape1Vertices = col1.GetVertices(); List <Vector2> shape2Vertices = col2.GetVertices(); //Add the shape position to each vertex List <Vector2> shape1VertPosition = new List <Vector2>(); foreach (var vert in shape1Vertices) { shape1VertPosition.Add(col1.GetPosition() + vert); } List <Vector2> shape2VertPosition = new List <Vector2>(); foreach (var vert in shape2Vertices) { shape2VertPosition.Add(col2.GetPosition() + vert); } //Check for overlap bool shape1Overlap = Overlapping(shape1VertPosition, shape2VertPosition); bool shape2Overlap = Overlapping(shape2VertPosition, shape1VertPosition); //Test code to add transparency if theres overlap if (!shape1Overlap || !shape2Overlap) { //not colliding iEntity ghj = (iEntity)col2; ghj.Transparency = 1f; } else { //colliding iEntity ghj = (iEntity)col2; ghj.Transparency = 0.5f; } }
public void Create(iEntity obj) { Blab blab = (Blab)obj; try { DateTime now = DateTime.Now; string sql = "INSERT INTO blabs (sys_id, message, dttm_created, user_id) VALUES ('" + blab.Id + "', '" + blab.Message + "', '" + now.ToString("yyyy-MM-dd HH:mm:ss") + "', '" + blab.User.Email + "')"; MySqlCommand cmd = new MySqlCommand(sql, this.dcBlab); cmd.ExecuteNonQuery(); } catch (Exception ex) { throw new Exception(ex.ToString()); } }
private void MidPhase(List <IShape> midList, IShape shape) { foreach (IShape col in midList) { iEntity Collider = (iEntity)shape; if (col.GetBoundingBox().Intersects(shape.GetBoundingBox())) { //Checks to see whether the vertices of the shape are the same as the bounding box if (!isSameAsBoundingBox(col) || !isSameAsBoundingBox(shape)) { //Go to narrow phase (SAT) if either shape isnt NarrowPhase(col, shape); } else { //collision alert - events or not? not sure yet, but probably Collider.CollidingEntity = (iEntity)col; Collider.isColliding = true; } } } }
/// <summary> /// Spawn entity into scene /// </summary> /// <param name="entityInstance">Spawn Entity</param> /// public void Spawn(iEntity entityInstance) { if (!storeEntity.Contains(entityInstance)) { // Insert entity into scene sceneGraph.addEntity(entityInstance); storeEntity.Add(entityInstance); if (entityInstance is iCollidable) { collManager.AddCollidable(entityInstance); } if (entityInstance is ICollisionListener) { var colEnt = (ICollisionListener)entityInstance; collManager.RaiseCollision += colEnt.Collision; collManager.AddCollisionListener(entityInstance); } renderMan.addEntity(entityInstance); } }
public void Remove(iEntity ent) { entityList.Remove(ent); uiList.Remove(ent); }
public override void PassIEntity(iEntity ent) { artefact = ent; }
public void UnLoad(iEntity ent) { sceneManager.Remove(ent); }
public Camera(iEntity sub, Rectangle cameraInfo) { subject = sub; viewPort = new Viewport(cameraInfo); }
/// <summary> /// Loads a single iEntities resource into memory /// </summary> /// <param name="ent">The entity to load</param> public void LoadResource(iEntity ent) { ent.Texture = contentMan.Load <Texture2D>(ent.TextureString); }
public void injectPathFinding(IPathFinding pPathFinder, iEntity pStar) { pathFinder = pPathFinder; Star = pStar; }
/// <summary> /// Add UI element to be rendered /// </summary> /// <param name="ui">The UI element to draw</param> public void addUI(iEntity ui) { uiList.Add(ui); }
/// <summary> /// Sets up the entity /// </summary> /// <param name="entity">The entity to setup</param> /// <param name="texture">The texture to set for that entity</param> /// <param name="pos">The position of the entity</param> private void Setup(iEntity entity, string texture, Vector2 pos, List <Vector2> verts) { var id = Guid.NewGuid(); entity.Setup(id, setEntityUName(entity.GetType().Name), texture, pos, verts); }
public void UnLoad(iEntity ent) { //not sure what this implementation looks like yet really throw new System.NotImplementedException(); }
public CollisionDetails(string uname, iEntity ent, Vector2 pMtv) { ColliderUname = uname; ColldingObject = ent; mtv = pMtv; }
public virtual void PassIEntity(iEntity ent) { }