public override void _Ready() { var size = GetViewportRect().Size; var windmill = new Windmill() { Position = new Vector2(size.x / 2, size.y - 100) }; AddChild(windmill); var spawner = new SimpleTouchSpawner() { SpawnFunction = (position) => { return(new SimpleBall() { Mass = 0.25f, Radius = 10, GlobalPosition = position }); } }; AddChild(spawner); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Model,Manufacturer,DateOfLastMaintenance")] Windmill windmill) { if (id != windmill.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(windmill); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WindmillExists(windmill.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(windmill)); }
private static void CalculateByte(Windmill super) { int op = super.program[super.index] % 16; super.index++; int loc1 = Memory.GetRamLoc(super); super.index++; int loc2 = Memory.GetRamLoc(super); switch (op) { case 0x00: super.ram[loc1] += super.ram[loc2]; break; case 0x01: super.ram[loc1] -= super.ram[loc2]; break; case 0x02: super.ram[loc1] *= super.ram[loc2]; break; case 0x03: super.ram[loc1] /= super.ram[loc2]; break; case 0x04: super.ram[loc1] %= super.ram[loc2]; break; } }
public static void Read(Windmill super) { int loc = Memory.GetRamLoc(super); byte value = (byte)Console.Read(); super.ram[loc] = value; }
private static void ReadKey(Windmill super) { int loc = Memory.GetRamLoc(super); ConsoleKey consoleKey = Console.ReadKey().Key; super.ram[loc] = (byte)consoleKey; }
static void AddByte(Windmill super) { int loc = GetRamLoc(super); super.index++; byte val = super.program[super.index]; super.ram[loc] = val; }
public void DisablePiece(GameObject gameObject) { foreach (Type toDestroy in typesToDestroyInChildren) { Component[] componentsInChildren = gameObject.GetComponentsInChildren(toDestroy); for (int i = 0; i < componentsInChildren.Length; i++) { Component subComponent = componentsInChildren[i]; if (subComponent.GetType() == typeof(PlanPiece)) { continue; } Object.Destroy(subComponent); } } Collider[] componentsInChildren3 = gameObject.GetComponentsInChildren <Collider>(); foreach (Collider collider in componentsInChildren3) { if (((1 << collider.gameObject.layer) & m_placeRayMask) == 0) { collider.gameObject.layer = m_planLayer; } } Transform[] componentsInChildren4 = gameObject.GetComponentsInChildren <Transform>(); int layer = m_planLayer; Transform[] array = componentsInChildren4; for (int i = 0; i < array.Length; i++) { array[i].gameObject.layer = layer; } AudioSource[] componentsInChildren8 = gameObject.GetComponentsInChildren <AudioSource>(); for (int i = 0; i < componentsInChildren8.Length; i++) { componentsInChildren8[i].enabled = false; } ZSFX[] componentsInChildren9 = gameObject.GetComponentsInChildren <ZSFX>(); for (int i = 0; i < componentsInChildren9.Length; i++) { componentsInChildren9[i].enabled = false; } Windmill componentInChildren2 = gameObject.GetComponentInChildren <Windmill>(); if ((bool)componentInChildren2) { componentInChildren2.enabled = false; } ParticleSystem[] componentsInChildren10 = gameObject.GetComponentsInChildren <ParticleSystem>(); for (int i = 0; i < componentsInChildren10.Length; i++) { componentsInChildren10[i].gameObject.SetActive(value: false); } UpdateTextures(); }
//returns x bytes at loc public static byte[] GetByteArray(Windmill super, int loc, int len) { byte[] bytes = new byte[len]; for (int i = 0; i < len; i++) { bytes[i] = super.ram[loc + i]; } return(bytes); }
public static void FindFunction(Windmill super) { super.index++; switch (super.program[super.index - 1] % 16) { case 0x00: Goto(super); break; } }
public static void ReadLine(Windmill super) { int loc = Memory.GetRamLoc(super); string input = Console.ReadLine() + (char)0; //end of string for (int i = 0; i < input.Length; i++) { super.ram[loc + i] = (byte)input[i]; } }
static void AddByte(Windmill super) { int loc = GetRamLoc(super); super.index++; byte val = super.program[super.index]; super.ram[loc] = val; Console.WriteLine(loc); }
public async Task <IActionResult> Create([Bind("ID,Model,Manufacturer,DateOfLastMaintenance")] Windmill windmill) { if (ModelState.IsValid) { _context.Add(windmill); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(windmill)); }
static void PrintString(Windmill super) { int loc = Memory.GetRamLoc(super); string capture = ""; for (; super.ram[loc] != 0; loc++) { capture += (char)super.ram[loc]; } Console.Write(capture); }
static void AddString(Windmill super) { int loc = GetRamLoc(super); for (int i = 0; super.program[super.index] != 0; i++) { super.index++; super.ram[loc + i] = super.program[super.index]; Console.WriteLine((char)super.ram[loc + i]); } }
static void AddString(Windmill super) { int loc = GetRamLoc(super); super.index++; for (int i = 0; super.program[super.index] != 0; i++) { super.ram[loc + i] = super.program[super.index]; super.index++; } }
private static void ConvertByte(Windmill super) { int loc = Memory.GetRamLoc(super); byte val = super.ram[loc]; char[] charArr = val.ToString().ToCharArray(); for (int i = 0; i < charArr.Length; i++) { super.ram[loc + i] = (byte)charArr[i]; } super.ram[loc + charArr.Length] = 0; }
//coverts next 4 bytes to signed int location public static int GetRamLoc(Windmill super) { byte[] rawloc = new byte[4]; rawloc[0] = super.program[super.index]; super.index++; rawloc[1] = super.program[super.index]; super.index++; rawloc[2] = super.program[super.index]; super.index++; rawloc[3] = super.program[super.index]; return((rawloc[0] << 24) + (rawloc[1] << 16) + (rawloc[2] << 8) + rawloc[3]); }
private static void CalculateInt(Windmill super) { int op = super.program[super.index]; super.index++; int finalLoc = Memory.GetRamLoc(super); byte[] rawVal1 = Memory.GetByteArray(super, finalLoc, 4); super.index++; byte[] rawVal2 = Memory.GetByteArray(super, Memory.GetRamLoc(super), 4); if (BitConverter.IsLittleEndian) { Array.Reverse(rawVal1); Array.Reverse(rawVal2); } int val1 = BitConverter.ToInt32(rawVal1); int val2 = BitConverter.ToInt32(rawVal2); switch (op) { case 0x00: val1 += val2; break; case 0x01: val1 -= val2; break; case 0x02: val1 *= val2; break; case 0x03: val1 /= val2; break; case 0x04: val1 %= val2; break; } byte[] rawResult = BitConverter.GetBytes(val1); if (BitConverter.IsLittleEndian) { Array.Reverse(rawResult); } for (int i = 0; i < 4; i++) { super.ram[finalLoc + i] = rawResult[i]; } }
public static void FindFunction(Windmill super) { super.index++; switch (super.program[super.index - 1] % 16) { case 0x00: ConvertByte(super); break; case 0x01: ConvertInt(super); break; } }
static void AddByteArray(Windmill super) { int loc = GetRamLoc(super); super.index++; byte len = super.program[super.index]; for (int i = 0; i < len; i++) { super.index++; super.ram[loc + i] = super.program[super.index]; } }
static void AddString(Windmill super) { int loc = GetRamLoc(super); super.index++; int i = 0; for (; super.program[super.index] != 0; i++) { super.ram[loc + i] = super.program[super.index]; super.index++; } super.ram[loc + i] = 0; //null terminate }
public void Reset() { VictoryPoints = 0; Money = 0; NumberOfRounds = 0; ResidualMoney = 0; RemainingBonusActions = 0; Round = 1; Hand = new Hand(); VineDeck = new Deck <VineCard>(Hand, _vineCards); OrderDeck = new Deck <OrderCard>(Hand, _orderCards); AutomaDeck = new Deck <AutomaCard>(Hand, _automaCards); SummerVisitorDeck = new Deck <VisitorCard>(Hand, _visitorCards.Where(p => p.Season == Season.Summer)); WinterVisitorDeck = new Deck <VisitorCard>(Hand, _visitorCards.Where(p => p.Season == Season.Winter)); Yoke = new Yoke(_eventAggregator); Trellis = new Trellis(_eventAggregator); Cottage = new Cottage(_eventAggregator); Windmill = new Windmill(_eventAggregator); Irigation = new Irigation(_eventAggregator); LargeCellar = new LargeCellar(_eventAggregator); TastingRoom = new TastingRoom(_eventAggregator); MediumCellar = new MediumCellar(_eventAggregator); Field1 = new Field(_eventAggregator, 5); Field2 = new Field(_eventAggregator, 6); Field3 = new Field(_eventAggregator, 7); Grande = new Grande(_eventAggregator); NeutralWorker = new Worker(_eventAggregator); _workers = new List <Worker>(); for (var i = 0; i < 5; i++) { _workers.Add(new Worker(_eventAggregator)); } InitializeGrapes(out _redGrapes, GrapeColor.Red); InitializeGrapes(out _whiteGrapes, GrapeColor.White); InitializeWines(out _redWines, WineType.Red, 9); InitializeWines(out _whiteWines, WineType.White, 9); InitializeWines(out _blushWines, WineType.Blush, 6); InitializeWines(out _sparklingWines, WineType.Sparkling, 3); }
public void DisablePiece(GameObject gameObject) { gameObject.layer = planLayer; Transform playerBaseTransform = gameObject.transform.Find("PlayerBase"); if (playerBaseTransform) { Object.Destroy(playerBaseTransform.gameObject); } foreach (Type toDestroy in typesToDestroyInChildren) { Component[] componentsInChildren = gameObject.GetComponentsInChildren(toDestroy); for (int i = 0; i < componentsInChildren.Length; i++) { Component subComponent = componentsInChildren[i]; if (subComponent.GetType() == typeof(PlanPiece)) { continue; } Object.Destroy(subComponent); } } AudioSource[] componentsInChildren8 = gameObject.GetComponentsInChildren <AudioSource>(); for (int i = 0; i < componentsInChildren8.Length; i++) { componentsInChildren8[i].enabled = false; } ZSFX[] componentsInChildren9 = gameObject.GetComponentsInChildren <ZSFX>(); for (int i = 0; i < componentsInChildren9.Length; i++) { componentsInChildren9[i].enabled = false; } Windmill componentInChildren2 = gameObject.GetComponentInChildren <Windmill>(); if ((bool)componentInChildren2) { componentInChildren2.enabled = false; } ParticleSystem[] componentsInChildren10 = gameObject.GetComponentsInChildren <ParticleSystem>(); for (int i = 0; i < componentsInChildren10.Length; i++) { componentsInChildren10[i].gameObject.SetActive(value: false); } }
public static void FindFunction(Windmill super) { super.index++; switch (super.program[super.index - 1] % 16) { case 0x00: Read(super); break; case 0x01: ReadLine(super); break; case 0x02: ReadKey(super); break; } }
public static void FindFunction(Windmill super) { super.index++; switch (super.program[super.index - 1] % 16) { case 0x00: AddByte(super); break; case 0x01: AddByteArray(super); break; case 0x02: AddString(super); break; } }
private static void ConvertInt(Windmill super) { int loc = Memory.GetRamLoc(super); byte[] rawVal = Memory.GetByteArray(super, loc, 4); if (BitConverter.IsLittleEndian) { Array.Reverse(rawVal); } int val1 = BitConverter.ToInt32(rawVal); char[] charArr = val1.ToString().ToCharArray(); for (int i = 0; i < charArr.Length; i++) { super.ram[loc + i] = (byte)charArr[i]; } super.ram[loc + charArr.Length] = 0; }
public static void Initialize(WindFarmContext context) { context.Database.EnsureCreated(); // Look for any windmills. if (!context.Windmills.Any()) { // DB has been not been seeded var windmills = new Windmill[] { new Windmill { Model = "Windmaster1090", Manufacturer = "SuperWind", DateOfLastMaintenance = DateTime.Parse("2005-09-01") }, }; foreach (Windmill w in windmills) { context.Windmills.Add(w); } } // Look for any samples. /* * if (!context.TurbineTelemetrySamples.Any()) * { * // DB has not been seeded * Assembly assembly = Assembly.GetExecutingAssembly(); * string resourceName = "RawWindmillTelemetryData.csv"; * * var embeddedProvider = new EmbeddedFileProvider(Assembly.GetExecutingAssembly()); * using (var stream = embeddedProvider.GetFileInfo("Data\\RawWindmillTelemetryData.csv").CreateReadStream()) * { * using (StreamReader reader = new StreamReader(stream)) * { * CsvReader csvReader = new CsvReader((IParser)reader); * var samples = csvReader.GetRecords<TurbineTelemetrySample>().ToArray(); * context.TurbineTelemetrySamples.AddRange(samples); * } * } * } */ context.SaveChanges(); }
public static void FindFunction(Windmill super) { super.index++; switch (super.program[super.index - 1] % 16) { case 0x00: PrintChar(super); break; case 0x01: PrintString(super); break; case 0x02: SetForeGroundColor(super); break; case 0x03: SetBackGroundColor(super); break; } }
private void loadInMachines() { AdvancedSolarPanel solarP1 = new AdvancedSolarPanel(new BasicItemInformation("Solar Panel", "Revitalize.Objects.Machines.SolarPanelV1", "Generates energy while the sun is up.", "Machine", Color.SteelBlue, -300, -300, 0, false, 1000, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "SolarPanelTier1"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "SolarPanelTier1"), new Animation(0, 0, 16, 16)), Color.White, false, new Vector2(1, 1), null, null), 2, 0); AdvancedSolarPanel solarA1V1 = new AdvancedSolarPanel(new BasicItemInformation("Solar Array", "Revitalize.Objects.Machines.SolarArrayV1", "A collection of solar panels that generates even more energy while the sun is up.", "Machine", Color.SteelBlue, -300, -300, 0, false, 1000, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "SolarArrayTier1"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "SolarArrayTier1"), new Animation(0, 0, 16, 16)), Color.White, false, new Vector2(1, 1), null, null), 8, 0); this.AddItem("SolarPanelTier1", solarP1); this.AddItem("SolarArrayTier1", solarA1V1); Machine miningDrillMachine_0_0 = new Machine(new BasicItemInformation("Mining Drill", "Revitalize.Objects.Machines.MiningDrill", "Digs up rocks and ores. Requires energy to run.", "Machine", Color.SteelBlue, -300, -300, 0, false, 4000, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "MiningDrillMachine"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "MiningDrillMachine"), new Dictionary <string, Animation>() { { "Default", new Animation(new AnimationFrame(0, 0, 16, 16)) }, { "Mining", new Animation(new List <AnimationFrame>() { new AnimationFrame(0, 0, 16, 32, 30), new AnimationFrame(16, 0, 16, 32, 30), new AnimationFrame(32, 0, 16, 32, 30), new AnimationFrame(48, 0, 16, 32, 30) }, true) } }, "Default", "Mining"), Color.White, false, new Vector2(1, 2), new InventoryManager(18, 3, 6), null), ModCore.ObjectManager.resources.miningDrillResources.Values.ToList(), ModCore.Configs.machinesConfig.miningDrillEnergyConsumption, ModCore.Configs.machinesConfig.miningDrillTimeToMine, ""); this.AddItem("MiningDrillMachineV1", miningDrillMachine_0_0); Windmill windMillV1_0_0 = new Windmill(new BasicItemInformation("Windmill", "Revitalize.Objects.Machines.WindmillV1", "Generates power from the wind.", "Machine", Color.SteelBlue, -300, -300, 0, false, 500, true, true, TextureManager.GetTexture(ModCore.Manifest, "Machines", "Windmill"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Machines", "Windmill"), new Dictionary <string, Animation>() { { "Default", new Animation(new AnimationFrame(0, 0, 16, 32)) }, { "Working", new Animation(new List <AnimationFrame>() { new AnimationFrame(0, 0, 16, 32, 20), new AnimationFrame(16, 0, 16, 32, 20) }, true) } }, "Default", "Working"), Color.White, false, new Vector2(1, 2), null, null, false, null, null), Vector2.Zero); this.AddItem("WindmillV1", windMillV1_0_0); }
static void PrintChar(Windmill super) { int loc = Memory.GetRamLoc(super); Console.Write((char)super.ram[loc]); }