public void StartGame() { if (!IsRunning) { Bird = new BirdModel(); Pipes = new List <PipeModel>(); MainLoop(); } }
public ActionResult Edit(BirdModel birdModel) { if (!ModelState.IsValid) { return(View(birdModel)); } birdRepo.UpdateBird(birdModel); return(RedirectToAction("Index")); }
// Update Bird public int UpdateBird(BirdModel Bird) { using (IDbConnection db = new SqlConnection(connection)) { string sql = @"UPDATE tblBird SET Name = @Name, ImageName = @ImageName, Description = @Description WHERE BirdID = @BirdID"; int rowsAffected = db.Execute(sql, Bird); return(rowsAffected); } }
// Get one Bird by BirdID (for update & details) public BirdModel GetOneBird(int BirdID) { using (IDbConnection db = new SqlConnection(connection)) { string sql = @"SELECT BirdID, Name, ImageName, Description FROM tblBird WHERE BirdID = @BirdID"; BirdModel Bird = db.Query <BirdModel>(sql, new { BirdID }).SingleOrDefault(); return(Bird); } }
// add Bird details public int AddBird(BirdModel Bird) { using (IDbConnection db = new SqlConnection(connection)) { // Dapper maps peron object to @parameters string sql = @"INSERT INTO tblBird (Name, ImageName, Description) VALUES (@Name, @ImageName, @Description)"; int rowsAffected = db.Execute(sql, Bird); return(rowsAffected); } }
// Use this for initialization public void init(float x, float y, EnvironmentManager em) { this.em = em; this.c = em.c; //this.type = type; this.transform.localPosition = new Vector3(x, y); var modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad); model = modelObject.AddComponent <BirdModel>(); model.init(this); this.transform.localScale = this.transform.localScale * 0.5f; }
static void Main(string[] args) { var bm = new BirdModel(); bm.BirdFils = new List <BirdFile> { new BirdFile { ID = 1, Name = "Bird A" }, new BirdFile { ID = 2, Name = "Bird B" } }; bm.BirdFils.ToList().ForEach(x => Console.WriteLine($"Name: {x.Name}, ID: {x.ID}")); Console.ReadKey(); }
public ActionResult Index(BirdModel birdModel, string submit, string birdSearch) { if (submit == "AddBird") { if (birdModel.BirdName == "" || birdModel.BirdName == null) { TempData["BirdNameEmpty"] = $"BirdName is empty"; } else { if (birdModel.BirdBehaviourList != null) { Session[birdModel.BirdName] = birdModel.BirdBehaviourList; TempData["BirdNameAdded"] = $"{birdModel.BirdName} added succesfullly"; return(RedirectToAction("Index")); } else { TempData["EmptyBehaviour"] = "Choose atleast one behaviour from list"; } } } if (submit == "Search") { if (birdSearch != "" && Session != null) { foreach (string bird in Session) { if (bird.ToUpper() == birdSearch.ToUpper()) { IBirdBehaviour b1 = new Bird(bird); BirdModel birds = b1.BirdDetail((List <string>)Session[bird]); ViewBag.BirdBehaviour = birds.BirdBehaviourList; ViewBag.BirdName = birds.BirdName; break; } } } else { ViewBag.SearchBird = $"You did not enter bird name or bird list"; } } return(View()); }
public void initBirdModel(bool alive) { if (alive) { Camera.main.transform.position = new Vector3(0, 0, -10); GameObject modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad); // Create a quad object for holding the bird texture. model = modelObject.AddComponent <BirdModel> (); // Add a bird_model script to control visuals of the bird. if (hasTrail) { addTrail(modelObject, trailColor); addSound(modelObject, birdClip); } model.init(this); } else { //print (positions.Count); GameObject modelObject2 = GameObject.CreatePrimitive(PrimitiveType.Quad); // Create a quad object for holding the bird texture. //model2.birdTrail.Clear(); model2 = modelObject2.AddComponent <BirdModel> (); // Add a bird_model script to control visuals of the bird. //print(modelObject2.name); if (hasTrail) { addTrail(modelObject2, trailColor); addSound(modelObject2, birdClip); } model2.init(this); //model2.mat.color = Color.black; //Set collider for dead birds to be a trigger //this.GetComponent<CircleCollider2D>().isTrigger = true; //model2.radiusCollider.isTrigger = true; } //Set collider for dead birds to be a trigger PolygonCollider2D col = this.GetComponent <PolygonCollider2D>(); Vector2[] points = new Vector2[] { new Vector2(.3f, -.4f), new Vector2(-.3f, -.4f), new Vector2(0f, .4f), new Vector2(.3f, -.4f) }; col.points = points; col.isTrigger = true; }
public void init(BirdModel owner) { this.owner = owner; transform.parent = owner.transform; // Set the model's parent to the bird. transform.localPosition = new Vector3(0, 0, 0); transform.localScale = new Vector3(7f, 7f, 1f); name = "Bird Radius"; containsBird = false; DestroyImmediate(this.gameObject.GetComponent <MeshCollider> ()); radiusCollider = this.gameObject.AddComponent <CircleCollider2D> (); radiusCollider.radius = .5f; radiusCollider.isTrigger = true; mat = GetComponent <Renderer>().material; // Get the material component of this quad object. mat.shader = Shader.Find("Sprites/Default"); // Tell the renderer that our textures have transparency. mat.mainTexture = Resources.Load <Texture2D>("Textures/radius"); // Set the texture. Must be in Resources folder. mat.color = new Color(1, 1, 1, .5f); // Set the color (easy way to tint things). initRadiusSound(); }
public GameManager() { Bird = new BirdModel(); Pipes = new List <PipeModel>(); }
public Bird(string birdName) { birds = new BirdModel(); birds.BirdName = birdName; birds.BirdBehaviourList = new List <string>(); }