public bool Endre(Fly fly) { using (var db = new DB()) { try { var dbflyentitet = db.Fly.Find(fly.ID); dbflyentitet.Modell = fly.Modell; dbflyentitet.AntallSeter = fly.AntallSeter; db.Endringer.Add(new DBEndring() { Endring = "Oppdaterte fly med id " + ID + ". Flymodell er " + dbflyentitet.Modell + ", antall seter " + dbflyentitet.AntallSeter, Tidspunkt = DateTime.Now }); db.SaveChanges(); return(true); } catch (Exception e) { DALsetup.LogFeilTilFil("DBFly:Endre", e, "En feil oppsto da metoden prøvde å oppdatere fly"); return(false); } } }
public void setFly(Fly fly) { this.fly = fly; foreach (Fly.Markers marker in fly.getMarkers()) { markerManager.toggleSelectively(marker, true); } if (fly.ismale()) { sext.text = "M"; } else { sext.text = "F"; } string traitNames = ""; foreach (TraitData trait in fly.getExpressedTraits()) { traitNames += (trait.name + ", "); } char[] charsToTrim = { ',', ' ' }; traitNames = traitNames.TrimEnd(charsToTrim); if (fly.getExpressedTraits().Count == 0) { traitNames = "Wild Type"; } traitText.text = traitNames; markerManager.sendPressedMarker += updateFlyMarker; }
// private Duck duckBehavior; void Awake() { inputState = GetComponent<InputState>(); flyBehavior = GetComponent<Fly>(); animator = GetComponent<Animator>(); collisionState = GetComponent<CollisionState>(); // duckBehavior = GetComponent<Duck>(); }
public void newFly() { fly = new Fly(); t = new Thread(fly.move); int x = fly.picture.Location.X + 25; int y = fly.picture.Location.Y + 25; controle = new Controle(x, y, FLY, listaControle); listaControle.Add(controle); fly.indexC = listaControle.IndexOf(controle); controle.positionC = listaControle.IndexOf(controle); controle.fly = fly; controle.frog = null; controle.sugar = null; controle.thread = t; fly.s_mutex = s_mutex; fly.listaControle = listaControle; Controls.Add(fly.picture); flyCont++; fly.flagFly = false; controle.thread.Start(); }
public void Reset() { if (_anim != null) { _anim.SetBool("IsPopped", false); } transform.localPosition = Vector3.zero; transform.rotation = Quaternion.identity; _child.transform.localPosition = Vector3.zero; _isPopped = false; _hasLostLife = false; Fly fly = GetComponent <Fly>(); if (fly != null) { fly.Speed = 2f; } GetComponent <Rigidbody2D>().gravityScale = 0f; _audioSourcePop.Stop(); _audioSourceHiss.Stop(); _audioSourceThump.Stop(); }
public static void Main() { //create a miner Miner bob = new Miner(0); //create his wife MinersWife elsa = new MinersWife(1); // create Bar's Fly Fly fly = new Fly(2); //register them with the entity manager EntityManager.Instance.RegisterEntity(bob); EntityManager.Instance.RegisterEntity(elsa); EntityManager.Instance.RegisterEntity(fly); //run Bob and Elsa through a few Update calls for (int i = 0; i < 50; i++) { bob.Update(); elsa.Update(); fly.Update(); MessageDispatcher.Instance.DispatchDelayedMessages(); System.Threading.Thread.Sleep(500); } }
private void SpawnFlyy() { Fly flyClone = (Fly)Instantiate(flyPrefab, transform.position, transform.rotation); flyClone.transform.SetParent(flyParent.transform); flyClone.transform.localPosition = new Vector3(Random.Range(xMinLeft, xMaxLeft), flyParent.transform.position.y, 0f); }
public string EndreFly(Fly item) { if (ErAdmin()) { if (ModelState.IsValid) { if (bllfly.Endre(item)) { return("true"); } else { return("En feil oppsto under lagring til databasen."); } } else { //Kilde: https://stackoverflow.com/questions/1352948/how-to-get-all-errors-from-asp-net-mvc-modelstate return(string.Join(".\n", ModelState.Values .SelectMany(x => x.Errors) .Select(x => x.ErrorMessage))); } } return("Ikke admin"); }
public IHttpActionResult PutFly(int id, Fly fly) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != fly.Id) { return(BadRequest()); } db.Entry(fly).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!FlyExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public void Release() { if (Act != null) { Act.Release(); } if (Hud != null) { Hud.Release(); } if (Fly != null) { Fly.Release(); } if (Ect != null) { Ect.Release(); } if (Nts != null) { Nts.Release(); } if (Lvl != null) { Lvl.Release(); } }
static void Main() { Plane myPlane = new Fly(); myPlane.Fly("Brazil"); myPlane.Fly(5); }
public override void Activate(Actor self, Order order) { var enterCell = self.World.ChooseRandomEdgeCell(); var plane = self.World.CreateActor("u2", new TypeDictionary { new LocationInit(enterCell), new OwnerInit(self.Owner), new FacingInit(Util.GetFacing(order.TargetLocation - enterCell, 0)), new AltitudeInit(Rules.Info["u2"].Traits.Get <PlaneInfo>().CruiseAltitude), }); plane.CancelActivity(); plane.QueueActivity(Fly.ToCell(order.TargetLocation)); plane.QueueActivity(new CallFunc(() => plane.World.AddFrameEndTask(w => { var camera = w.CreateActor("camera", new TypeDictionary { new LocationInit(order.TargetLocation), new OwnerInit(self.Owner), }); camera.QueueActivity(new Wait(25 * (Info as SpyPlanePowerInfo).RevealTime)); camera.QueueActivity(new RemoveSelf()); }))); plane.QueueActivity(new FlyOffMap()); plane.QueueActivity(new RemoveSelf()); }
private void cross(Fly maleParent, Fly femaleParent) { foreach (TraitData.TraitID key in traits.Keys.ToList()) { if (traits[key].getTraitData().isIntermediate() && traits[traits[key].getTraitData().complimentaryTraitID].getAlleles() < 3) { traits[key].setAlleles(traits[traits[key].getTraitData().complimentaryTraitID].getAlleles()); } else { int alleles = maleParent.traits[key].getGameteAlleles(true, !isMale) + femaleParent.traits[key].getGameteAlleles(false, !isMale); traits[key].setAlleles(alleles); } if (traits[key].isPresent(isMale)) { if (!expressedTraits.ContainsKey(traits[key].getTraitData().PGID) || expressedTraits[traits[key].getTraitData().PGID].priority > traits[key].getTraitData().priority) { expressedTraits[traits[key].getTraitData().PGID] = traits[key].getTraitData(); } } } }
//Delegate (Homework5) private static void DelegateHW5() { XWing myXWing = new XWing("Rogue Leader", 7); Fly theXWing = myXWing.FlyXWing; theXWing("I flew with " + myXWing.XWingType + " who was a rank of " + myXWing.XWingRank); }
public void Create() { //instantiating the object for (byte i = 0; i < count; i++) { //creating the FLY object GameObject prefab = (GameObject)Instantiate(Resources.Load("Fly")); //positioning insite the radius you specified prefab.transform.position = thisTransform.position + RandomInsideSphere(); //random rotation to start movement prefab.transform.rotation = Quaternion.Euler(new Vector3(RandomInside360(), RandomInside360(), RandomInside360())); //setting up the fly component Fly f = prefab.GetComponent <Fly>(); f.forwardSpeed = (useRandom) ? Random.Range(randomForward.x, randomForward.y) : forwardSpeed; f.angularSpeed = (useRandom) ? Random.Range(randomAngular.x, randomAngular.y) : angularSpeed; f.targetPosition = thisTransform.position + RandomInsideSphere(); f.transform.parent = thisTransform; f.debug = debug; //use trail renderer ? if (!useTrail) { Destroy(f.GetComponent <TrailRenderer>()); } //adding to the list list.Add(f); } run = true; StartCoroutine("Retarget"); }
private static void Fly_updateAnimation_prefix(Fly __instance, GameTime time, ref int ___invincibleCountdown) { if (__instance.Health <= 0 || Config.MonstersIgnorePlayer) { ___invincibleCountdown = 1; } }
public void LoadDtoFly() { foreach (var fly in _dtoFlySingleton.FlyListe) { Fly.Add(fly); } }
public void Release() { if (Act != null) { Act.Release(); } if (Hud != null) { Hud.Release(); } if (Fly != null) { Fly.Release(); } if (Ect != null) { Ect.Release(); } if (Nts != null) { Nts.Release(); } for (int i = 0; i < Characters.Count; i++) { Character cc = Characters[i]; cc.Release(); } Characters.Clear(); Main = null; Enem = null; }
Monster CreateRandomMonster(Vector2 location) { Monster monster = null; if (Game1.isDarkOut() && CanHazMonster(Settings.Monsters.Bat)) { monster = new Bat(new Vector2()); } else if (Game1.isDarkOut() && CanHazMonster(Settings.Monsters.Ghost)) { monster = new Ghost(new Vector2()); } else if (CanHazMonster(Settings.Monsters.BigSlime)) { monster = new BigSlime(new Vector2(), GetSlimeLevel()); } else if (CanHazMonster(Settings.Monsters.Grub)) { monster = new Grub(new Vector2(), true); } else if (CanHazMonster(Settings.Monsters.Fly)) { monster = new Fly(new Vector2(), true); } else if (CanHazMonster(Settings.Monsters.Brute)) { monster = new ShadowBrute(new Vector2()); } else if (CanHazMonster(Settings.Monsters.Golem)) { monster = new RockGolem(new Vector2(), deepWoods.GetCombatLevel()); } else if (CanHazMonster(Settings.Monsters.RockCrab)) { monster = new RockCrab(new Vector2(), GetRockCrabType()); } else { foreach (var modMonster in DeepWoodsAPI.ToShuffledList(ModEntry.GetAPI().Monsters)) { if (modMonster.Item1(deepWoods, location)) { monster = modMonster.Item2(); break; } } if (monster == null) { monster = new GreenSlime(new Vector2(), GetSlimeLevel()); } } if (deepWoods.level.Value >= Settings.Level.MinLevelForBuffedMonsters && !this.random.CheckChance(Settings.Monsters.ChanceForUnbuffedMonster)) { BuffMonster(monster); } return(monster); }
private static void Fly_BitByPlayer(On.Fly.orig_BitByPlayer orig, Fly self, Creature.Grasp grasp, bool eu) { orig.Invoke(self, grasp, eu); for (int i = 0; i < 2; i++) { self.room.AddObject(new BloodParticle(self.mainBodyChunk.pos, new Vector2(UnityEngine.Random.Range(-3f, 3f), UnityEngine.Random.Range(1f, 5f)), BloodMod.creatureColors["Fly"], "Fly", null, 1.3f)); } }
public void Move() { if (MoveBehavior == null) { MoveBehavior = new Fly(); } this.MoveBehavior.Move(this); }
private float Fitness(Fly fly, Goal goal) { float fitness = 0; fitness = Vector2.Distance(goal.position, fly.position); return(fitness); }
public States(None none, Jump jump, Fall fall, Land land, Fly fly) { this.none = none; this.jump = jump; this.fall = fall; this.land = land; this.fly = fly; }
public void DeleteFly(object param) { int id = (int)param; Fly selectedfly = Fly.Single(x => x.Id.Equals(id)); _dtoFlySingleton.DeleteFly(id); Fly.Remove(selectedfly); _dtoFlySingleton.LoadFly(); }
public new void CreateFlies() { for (int i = 0; i < Random.Range(1, Constants.PlayerCount); i++) { Fly fly = Instantiate(zombieFliePrefab, transform.position, Quaternion.identity); fly.Initialize(this); spawnedFlies.Add(fly); } }
// Use this for initialization void Awake() { fly = GetComponent <Fly>(); chase = GetComponent <Chase>(); body = GetComponent <ChipmunkBody>(); shape = GetComponent <ChipmunkShape>(); PauseGameManager.Instance.register(this, gameObject); }
public Task Update(Fly flyModel) { using (var dbContext = new ApplicationDbContext(_dbContextOptions)) { dbContext.Update(flyModel); dbContext.SaveChanges(); return(Task.CompletedTask); } }
public async Task <Fly> Add(Fly flyModel) { using (var dbContext = new ApplicationDbContext(_dbContextOptions)) { dbContext.Add(flyModel); dbContext.SaveChanges(); return(await Task.FromResult(flyModel)); } }
public void Engine() { Fly fly = (int c) => { Console.Write("{0}", c); }; fly(4); }
public bool LeggInn(Fly innfly) { if (innfly != null && innfly.ID > 0 && innfly.Modell != null && innfly.AntallSeter > 0) { fly.Add(innfly); return(true); } return(false); }
protected override void ownStart() { base.usageLeft = 0; base.destroyTime = lifeTimeSecs; base.firePow = 0f; fly = GetComponent <Fly>(); timerAlive = 0f; rateOfFly = 0f; }
public static void Main(string[] args){ SuperHero superHero = new HiperMan(); superHero.actLikeAHero(); SuperHero superHeroFly = new Fly(); SuperHero superHeroXRay = new XRay(); superHeroFly.setSuperHero(superHero); superHeroFly.usePower(); superHeroXRay.setSuperHero(superHero); superHeroXRay.usePower(); }
void FlyInitAndEnable(Fly fly) { float posX; MoveDirection moveDir; if (Random.Range(0, 2) == 0) { moveDir = MoveDirection.LEFT; posX = spawnMax.x; } else { moveDir = MoveDirection.RIGHT; posX = spawnMin.x; } float posY = Random.Range(spawnMin.y, spawnMax.y); float scale = Random.Range(minScale, maxScale); float speed = Random.Range(minSpeed, maxSpeed); float moveHeight = Random.Range(minMoveHeight, maxMoveHeight); fly.Init(posX, posY, scale, speed, moveHeight, moveDir); }
/// <summary> /// helper method to create a fly from the trait strings javascript sends over /// </summary> /// <param name="p_module">Module parameter for the new fly</param> /// <param name="p_gender">Gender parameter for the new fly</param> /// <param name="p_traits">Array of TraitIDs for the new fly</param> /// <returns>A new Fly, null if it fails</returns> private Fly LogFly(int p_module, UseInstance p_instance, string p_gender, ReducedTraitModel[] p_traits) { Fly toAdd = new Fly() { Id = 0 }; try { toAdd.Gender = db.Gender.First(t => t.GenderName == p_gender); toAdd.Module = db.Module.First(t => t.Call_id == p_module); toAdd.UseInstance = p_instance; } catch (Exception e) { Exception ex = new InvalidOperationException("Something in the configuration of gender or module is wrong. This should be easily fixable through the Admin Dashboard.", e); Elmah.ErrorSignal.FromCurrentContext().Raise(ex); return null; } //foreach (ReducedTraitModel cur in p_traits) //{ // Trait newTrait = GetTrait( db.Trait.Find(cur.Id), cur.IsHeterozygous ); // toAdd.Traits.Add(newTrait); // db.Entry(newTrait).State = EntityState.Detached; //} db.Fly.Add(toAdd); try { db.SaveChanges(); } catch (Exception e) { Exception ex = new InvalidOperationException("There was an issue storing a fly (Lab/NewFly).", e); Elmah.ErrorSignal.FromCurrentContext().Raise(ex); return null; } return toAdd; }