static void Main(string[] args) { PC pc = new PC(); GPU gpu = new GPU(); gpu.Name = "Titan X"; gpu.Memory = "12"; List<GPU> gpus = new List<GPU>(); gpus.Add(gpu); gpus.Add(gpu); RAM ram = new RAM(); RAM ram2 = new RAM(); List<RAM> rams = new List<RAM>(); ram.Memory = 8; ram2.Memory = 4; rams.Add(ram); rams.Add(ram); rams.Add(ram2); rams.Add(ram2); CPU cpu = new CPU(); cpu.Cores = 4; cpu.Speed = 3.5; pc.CPU = cpu; pc.GPU = gpus; pc.RAM = rams; pc.PrintData(); }
public IEnumerator RespawnPlayerCo() { //Generate Death Particle Instantiate(deathParticle, pcRigid.transform.position, pcRigid.transform.rotation); //Hide PC player.SetActive(false); pcRigid.GetComponent <Renderer> ().enabled = false; //Gravity Reset gravityStore = pcRigid.GetComponent <Rigidbody2D>().gravityScale; pcRigid.GetComponent <Rigidbody2D>().gravityScale = 0f; pcRigid.GetComponent <Rigidbody2D>().velocity = Vector2.zero; //Point Penalty ScoreManager.AddPoints(-PointPenaltyOnDeath); //Debug Message Debug.Log("PC Respawn"); //Respawn Delay yield return(new WaitForSeconds(RespawnDelay)); //Gravity Restore PC.GetComponent <Rigidbody2D>().gravityScale = gravityStore; //Match PCs transform position PC.transform.position = currentCheckPoint.transform.position; //Show PC player.SetActive(true); pcRigid.GetComponent <Renderer> ().enabled = true; //Spawn PC Instantiate(respawnParticle, CurrentCheckPoint.transform.position, CurrentCheckPoint.transform.rotation); }
public SubStateRuneSelect(StateAbstract theparent, Character thePC) : base(theparent) { curr = (PC) thePC; parent = theparent; StateHandler.AddDelay(); messageBoxes = new MessageBox[1]; int i, size = calcSize(); colors = new Color[size]; menu = new string[size]; for (i = 0; i < size; i++) menu[i] = curr.runes[i].Name; for (; i < size; i++) menu[i] = ""; if(colors.Length > 0) colors[0] = Color.White; for (i = 1; i < colors.Length; i++) colors[i] = Color.DarkGray; mX = 100; mY = 45; width = 900; height = 630; messageBoxes[0] = new MessageBox(mX, mY, width, height, menu, colors, true, true, true); }
static void Main(string[] args) { PC pc1 = new PC("Home PC", "DELL123-454ItX", 4, 1000), pc2 = new PC("Office PC", "AMD354-454IX", 2, 500), pc3 = new PC("Server PC", "Intel25-454Itm", 16, 2000), pc4 = new PC("Home PC", "HP-454ItX", 8, 1000); List <PC> listPC = new List <PC>(4) { pc1, pc2, pc3, pc4 }; string filePath = @"\listSerial.txt", dirPath = @"D:\example", filePath1 = @"\object1.txt", dirPath1 = @"D:\example1", filePath2 = @"\object2.txt", dirPath2 = @"D:\example2", filePath3 = @"\object3.txt", dirPath3 = @"D:\example3", filePath4 = @"\object4.txt", dirPath4 = @"D:\example4"; try { SerializedObject(listPC, filePath, dirPath); SerializedObject(pc1, filePath1, dirPath1); SerializedObject(pc2, filePath2, dirPath2); SerializedObject(pc3, filePath3, dirPath3); SerializedObject(pc4, filePath4, dirPath4); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
static void Main() { ShowConsole(":: Computers ::"); ShowConsole(":: Deserializ ALL ::"); List <PC> computers = new List <PC>(3); DeserializAllPC("D:\\listSerial.txt", ref computers); foreach (PC computer in computers) { computer.RegistrHandler(new PC.PCStateHandler(ShowConsole)); computer.info(); } ShowConsole(":: Deserializ One ::"); PC compDes = new PC(); DeserializPC("D:\\Lenovo_01.txt", ref compDes); //compDes.RegistrHandler(new PC.PCStateHandler(ShowConsole)); compDes._del = ShowConsole; compDes.info(); ShowConsole("Programm complite"); Console.ReadKey(); }
//Calls the monitoring methods by running new tasks public void StartMonitoring(TextBox usageTextBox, TextBox warningTextBox, PC monitor, int minutes, int seconds) { Task.Run(() => anomaly.SetNormalUsageByTime(minutes, seconds)); PerformanceCounter performanceCounter = new PerformanceCounter(); bool processes = false; switch (monitor) { case PC.CPU: performanceCounter.CategoryName = "Processor"; performanceCounter.CounterName = "% Processor Time"; performanceCounter.InstanceName = "_Total"; Postfix = "%"; break; case PC.RAM: performanceCounter.CategoryName = "Memory"; performanceCounter.CounterName = "Available MBytes"; Postfix = "MB"; break; case PC.PROCESSES: processes = true; Task.Run(() => ProcessMonitoring(usageTextBox, warningTextBox)); break; default: MessageBox.Show("Didn't work"); break; } if (!processes) Task.Run(() => { Monitoring(usageTextBox, warningTextBox, performanceCounter); }); }
public void CannotCreatePCWithEmptyGenre1() { Assert.Catch(() => { var x = new PC("Age of Empires", null, "Microsoft Games", "PC", 30); }); }
public void TestPCAddPartWithInvalidPart() { PC pc = new PC("Toshiba"); IPart phonePart = new PhonePart("Keyboard", 85); Assert.Throws <InvalidOperationException>(() => pc.AddPart(phonePart)); }
public bool OnCommand(Character chr, string args) { if (args == null) { chr.WriteToDisplay("Who do you want to boot?"); return(false); } try { PC pc = PC.GetOnline(args); if (pc == null) { chr.WriteToDisplay("Unable to find player named " + args + "."); return(false); } chr.WriteToDisplay("You have booted the player named " + pc.Name + "."); pc.DisconnectSocket(); return(true); } catch (Exception e) { Utils.LogException(e); chr.WriteToDisplay("Failed to boot the requested player from the game. See a developer for details."); return(false); } }
public void TestShouldNotBeAbleToAddNonPCPart() { IPart laptopPart = new LaptopPart("CD", 10m); IRepairable pc = new PC(makeTest); Assert.Throws <InvalidOperationException>(() => pc.AddPart(laptopPart)); }
// Handles gamestate change to castle phase. private void InitCastlePhase() { currentWave = 0; castlePromptTime = Time.timeSinceLevelLoad + castlePromptTimerDelay; audioRef.PlayBuildThemePlaylist(); PC.InitCastlePhase(); }
public ServicoPC(PC pc) { InitializeComponent(); Usuario u = new Usuario(); pcAtual = u.sp_readPCByUID(pc); carregarCampos(u, pcAtual); }
//Methods public void LoadGame() { string playingOn = ""; switch (GamingSystem) { case GamingSystem.PC: playingOn = PC.ToString(); break; case GamingSystem.Nintendo: playingOn = Nintendo.ToString(); break; case GamingSystem.PlayStation: playingOn = PlayStation.ToString(); break; case GamingSystem.Xbox: playingOn = Xbox.ToString(); break; case GamingSystem.Sega: playingOn = Sega.ToString(); break; default: playingOn = "system that we are not sure about"; break; } Console.WriteLine($"You have loaded the game on a {playingOn}."); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Processor,Videocard,Ram")] PC pC) { if (id != pC.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(pC); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PCExists(pC.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(pC)); }
public void Test_Add_AddsItemToInventory() { //Arrange PC testPC = new PC("Crom"); testPC.Save(); Item testItem = new Item("Sword"); testItem.Save(); Item testItem2 = new Item("Torch"); testItem2.Save(); //Act testPC.AddItemToPC(testItem); testPC.AddItemToPC(testItem2); List <Item> result = testPC.GetItems(); List <Item> testList = new List <Item> { testItem, testItem2 }; //Assert CollectionAssert.AreEqual(testList, result); }
// GET: Baskets public async Task <IActionResult> Index() { List <PC> basketItems = new List <PC>(); string user = _userManager.GetUserId(HttpContext.User); var basket = _context.Basket .Include(b => b.PC) .Include(b => b.User) .AsEnumerable().Where(b => b.UserID == user); foreach (Basket b in basket) { var pc = _context.PC .Include(p => p.Case) .Include(p => p.Graphics) .Include(p => p.Memory) .Include(p => p.Processor) .Include(p => p.Storage) .FirstOrDefaultAsync(m => m.ID == b.PCID); basketItems.Add(await pc); PC pC = await pc; b.PC = pC; } return(View(basket)); }
public IActionResult Add(PC pc) { if (ModelState.IsValid) { PC newPC = new PC { PCCase = pc.PCCase, PCCooling = pc.PCCooling, PCCpu = pc.PCCpu, PCGpu = pc.PCGpu, PCMainboard = pc.PCMainboard, PCPsu = pc.PCPsu, PCRam = pc.PCRam, PCStorage = pc.PCStorage, ProductId = pc.ProductId, PCCategoryId = pc.PCCategoryId }; dataContext.PCs.Add(newPC); dataContext.SaveChanges(); return(RedirectToAction("Index", "PC")); } else { var item = dataContext.Products.Where(p => p.CategoryId == 2).ToList(); ViewBag.Selected = new SelectList(item, "ProductId", "ProductName"); var category = dataContext.PCCategories.Select(p => p).ToList(); ViewBag.Category = new SelectList(category, "PCCategoryId", "PCCategoryName"); return(View(pc)); } }
public IActionResult Edit(int id, PC pc) { if (ModelState.IsValid) { PC oldPC = dataContext.PCs.FirstOrDefault(p => p.ProductId == id); oldPC.PCMainboard = pc.PCMainboard; oldPC.PCCpu = pc.PCCpu; oldPC.PCCase = pc.PCCase; oldPC.PCCooling = pc.PCCooling; oldPC.PCGpu = pc.PCGpu; oldPC.PCPsu = pc.PCPsu; oldPC.PCRam = pc.PCRam; oldPC.PCStorage = pc.PCStorage; oldPC.PCCategoryId = pc.PCCategoryId; dataContext.SaveChanges(); ViewBag.Status = 1; return(RedirectToAction("Index", "PC")); } else { var item = dataContext.Products.Where(p => p.CategoryId == 2).ToList(); ViewBag.Selected = new SelectList(item, "ProductId", "ProductName"); var category = dataContext.PCCategories.Select(p => p).ToList(); ViewBag.Category = new SelectList(category, "PCCategoryId", "PCCategoryName"); } return(View(pc)); }
// Finds the nearest PC; public void FindNearestPC() { // Initially set distance to a high number. nearestPCDistance = Mathf.Infinity; foreach (GameObject PC in pcList) { playerCharTemp = PC.GetComponent <CharacterTemplate>(); if (playerCharTemp.isDead == false) { // Grabs the distance between this enemy and a PC in the array. float distance = Vector3.Distance(transform.position, PC.transform.position); if (distance < nearestPCDistance) { nearestPC = PC; nearestPCDistance = distance; } MoveToNearestPC(); } else { Debug.Log("NO TARGET"); StopUnit(); } } }
//Métodos public void carregarCampos(Usuario u, PC pc) { //Carrega Combo cbStatus.DataSource = u.sp_readComboServicos().Tables[0]; cbStatus.DisplayMember = "nomeServico"; cbStatus.ValueMember = "uid_tipoServico"; //Carrega Infos txtID.Text = Convert.ToString(pc.uid_pc); txtCPFCliente.Text = pc.cpfCliente; cbStatus.SelectedValue = pc.fk_tipoServico; if (pc.statuspc == true) { rdbtnPronto.Checked = true; } else { rdbtnNaoPronto.Checked = true; } txtProcessador.Text = pc.processador; txtPlacaMae.Text = pc.placaMae; txtFonte.Text = pc.fonte; txtCoolerCPU.Text = pc.coolerProcessador; txtRam.Text = pc.memoriaRam; txtHD.Text = pc.hd; txtSSD.Text = pc.ssd; txtVGA.Text = pc.placaDeVideo; txtGabinete.Text = pc.gabinete; txtObs.Text = pc.observacoes; }
public void CannotCreatePCWithEmptyName2() { Assert.Catch(() => { var x = new PC("", "Strategy", "Microsoft Games", "PC", 30); }); }
public async Task <IActionResult> Edit(int id, [Bind("UserId,Id,CPU,GPU,MOBO")] PC pC) { if (id != pC.Id) { return(View("Error")); } if (ModelState.IsValid) { try { _context.Update(pC); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PCExists(pC.Id)) { return(View("Error")); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["UserId"] = new SelectList(_context.SiteUsers, "Id", "Username", pC.UserId); return(View("Edit", pC)); }
/// <summary> /// Finds a Path to the given PresetUnit /// </summary> /// <param name="Preset">The Preset Unit to path to</param> /// <returns>A Path object containg the Path's Coordinates</returns> public Path FindPath(PresetUnit Preset) { PC Me = new PC(); this.presetunit = Preset; return(FindPath(Preset.X, Preset.Y, Me.X, Me.Y)); }
public bool OnCommand(Character chr, string args) { PC pc = (chr as PC); if (args == null) { pc.DisplayDamageShield = !pc.DisplayDamageShield; chr.WriteToDisplay("Display damage shield option set to " + (pc.DisplayDamageShield ? "ON" : "OFF") + "."); } else { if (args.ToLower() == "off") { pc.DisplayDamageShield = false; chr.WriteToDisplay("Display damage shield option set to OFF."); } else if (args.ToLower() == "on") { pc.DisplayPetMessages = true; chr.WriteToDisplay("Display damage shield option set to ON."); } else { chr.WriteToDisplay("Format: displaydmgshield [off | on]"); } } return(true); }
public void ConductVote() // cycle through each character's vote { bool doneVoting = true; for (int i = 0; i < characters.Length; i++) { Character selectedChar = characters[i]; doneVoting = true; if (!selectedChar.eliminated && !selectedChar.voted) { doneVoting = false; myTalk.variables[1].variableValue = selectedChar.myName; if (selectedChar is PC) { PC playerChar = selectedChar as PC; playerChar.PlayerVote(); break; } else if (selectedChar is NPC) { NPC npcChar = selectedChar as NPC; npcChar.CastVote(); break; } } } if (doneVoting) { TallyVote(); } }
public SubStateSpellSelect(StateAbstract theparent, SpellAbstract[] theSpells, PC thePC) : base(theparent) { spells = theSpells; curr = thePC; parent = theparent; StateHandler.AddDelay(); messageBoxes = new MessageBox[1]; int i; colors = new Color[spells.Length]; menu = new string[spells.Length]; for (i = 0; i < spells.Length && spells[i] != null; i++) menu[i] = spells[i].Name; for (; i < spells.Length; i++) menu[i] = ""; if (colors.Length > 0) colors[0] = Color.White; for (i = 1; i < colors.Length; i++) colors[i] = Color.DarkGray; mX = 190; mY = 75; width = 780; height = 570; messageBoxes[0] = new MessageBox(mX, mY, width, height, menu, colors, true, true, true); }
// Start is called before the first frame update void Start() { // Only call the Update() function during an active Wave. enabled = false; // Load Play map. SetPlayMapPath(); string path = playMapPath + playMapName; List <List <int> > SavedMap = mapEditorManagerRef.LoadMapFromFile(path); if (!tileMapRef.GenerateMapFromList(SavedMap)) { Debug.Log("Failed to Generate Map from Saved File!"); } // Init gameplay variables roundTimer = roundLengthInSeconds; currentWave = 1; currentRound = 1; UIMenuRef.UpdateRoundTimer(); UIMenuRef.UpdateWaveNumber(); UIMenuRef.UpdateRoundNumber(); currency = 1000; PC.inEditMode = false; PC.InitPlayMode(); }
private string GetPC(PC pc) { try { switch (pc) { case VrManager.Data.Entity.PC.PC1: { return("ПК1"); } case VrManager.Data.Entity.PC.PC2: { return("ПК2"); } default: return(""); } } catch (Exception ex) { App.SendException(ex); return(null); } }
private void populatePlayerComboBoxes() { int a; currentPC = new PC(); for (a = 0; a < Enum.GetNames(currentPC.gender.GetType()).Length; a++) // gender combo box { cmbobxPlayerGender.Items.Add(Enum.GetName(currentPC.gender.GetType(), a)); } for (a = 0; a < Enum.GetNames(currentPC.BaseProfession.GetType()).Length; a++) // class type combo box { cmbobxPlayerClass.Items.Add(Utils.FormatEnumString(Enum.GetName(currentPC.BaseProfession.GetType(), a))); } for (a = 0; a < Enum.GetNames(currentPC.Alignment.GetType()).Length; a++) // alignment combo box { cmbobxPlayerAlignment.Items.Add(Enum.GetName(currentPC.Alignment.GetType(), a)); } for (a = 0; a < World.GetFacetByIndex(0).Lands.Count; a++) // lands combo box { cmbobxPlayerLand.Items.Add(World.GetFacetByIndex(0).GetLandByIndex(a).Name); } for (a = 0; a < Enum.GetNames(currentPC.ImpLevel.GetType()).Length; a++) // implevel combo box { cmbobxPlayerImpLevel.Items.Add(Enum.GetName(currentPC.ImpLevel.GetType(), a) + "(" + a.ToString() + ")"); } }
public IActionResult Index(int id) { Product product = dataContext.Products.FirstOrDefault(p => p.ProductId == id); Brand brand = dataContext.Brands.FirstOrDefault(p => p.BrandId == product.BrandId); if (product.CategoryId == 1) { Laptop laptop = dataContext.Laptops.FirstOrDefault(p => p.ProductId == product.ProductId); if (laptop == null) { ViewBag.Status = 1; } else { ViewBag.Laptop = laptop; LaptopCategory laptopCategory = dataContext.LaptopCategories.FirstOrDefault(p => p.LaptopCategoryId == laptop.LaptopCategoryId); ViewBag.Category = laptopCategory.LaptopCategoryName; } } else { PC pc = dataContext.PCs.FirstOrDefault(p => p.ProductId == product.ProductId); if (pc == null) { ViewBag.Status = 1; } else { ViewBag.PC = pc; PCCategory pCCategory = dataContext.PCCategories.FirstOrDefault(p => p.PCCategoryId == pc.PCCategoryId); ViewBag.Category = pCCategory.PCCategoryName; } } return(View(product)); }
public static void startEvent(PC pc, Balance balance, string event_name = "") { _pc = pc; _balance = balance; if (event_name != "") { } else { int event_index = rnd.Next(0, _events_list.Count); string event_string = _events_list[event_index]; switch (event_string) { case "GPUBroken": GPUBroken(); break; case "YouFindAPassport": YouFindAPassport(); break; default: break; } } Saver.save(); }
public void ProcessPlayerConnection() { NetworkStream stream = null; _dbConnection.Open(); try { stream = _client.GetStream(); while (true) { int packetType = stream.ReadByte(); switch (packetType) { case (int)ServerPackets.AUTH_VIEW: { ProcessPackets.GetAuthView(stream); } break; case (int)ServerPackets.AUTHENTICATION_DATA: { _playerRef = ProcessPackets.AuthenticationData(stream, _dbConnection); } break; case (int)ServerPackets.REGISTRATION_VIEW: { ProcessPackets.GetRegistrationView(stream); } break; case (int)ServerPackets.REGISTRATION_DATA: { ProcessPackets.RegisterPlayer(stream, _dbConnection); } break; } } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { if (stream != null) { stream.Close(); } if (_client != null) { _client.Close(); } if (_client != null) { _dbConnection.Close(); } } }
public void GetAll_DatabaseEmptyAtFirst_0() { //Arrange, Act int result = PC.GetAll().Count; //Assert Assert.AreEqual(0, result); }
public void EditLoadsInvalidId() { var result = controller.Edit(-1); var viewResult = (ViewResult)result.Result; PC model = (PC)viewResult.Model; Assert.AreNotEqual(_context.PC.FindAsync(-1), model); }
static void Main(string[] args) { Apple myA = new Apple(); PC myPc = new PC(); Console.WriteLine($"Apple OS: {myA.OperatingSys}"); Console.WriteLine($"Microsoft OS: {myPc.OperatingSys}"); }
private void Start() { pc = GetComponent<PC>(); pcSprite = GetComponent<SpriteRenderer>(); standImage = Resources.Load<Sprite>("Carp/Carp_stand"); jumpImage = Resources.Load<Sprite>("Carp/Carp_jump"); }
protected override void Start() { base.Start(); attackable.Group = 1; pc = GameObject.Find("Carp").GetComponent<PC>(); attackDelay = 0; }
private void Start() { pc = GameObject.Find("Carp").GetComponent<PC>(); foreach (Transform child in transform) { if (child.gameObject.name == "HP") { hp = child.gameObject; } } }
public HUD(PC player, Corner corner) { //TODO: again, a textureloader. //load up all the things. BackPanel = Utils.TextureLoader("hud/backPanel.png"); ItemFrame = Utils.TextureLoader("hud/itemFrame.png"); ItemFrameBig = Utils.TextureLoader("hud/itemFrameBig.png"); StatBar = Utils.TextureLoader("hud/statBar.png"); Player = player; Ccorner = corner; }
public Boolean EditPC() { PC EditedPC = new PC(); EditedPC.PCID = int.Parse(Request.Params["id"]); EditedPC.PCName = Request.Params["name"]; EditedPC.Price = float.Parse(Request.Params["price"]); EditedPC.PCDescriptions = Request.Params["description"]; EditedPC.PCStatus = int.Parse(Request.Params["status"]); if (PCService.EditPC(EditedPC)) { return true; } return false; }
public Boolean Add() { PC NewPC = new PC(); NewPC.PCName = Request.Params["name"]; NewPC.Price = float.Parse(Request.Params["price"]); NewPC.PCDescriptions = Request.Params["description"]; NewPC.NetCafeID = int.Parse(Request.Params["netcafeAddress"]); NewPC.PCStatus = int.Parse(Request.Params["status"]); if (PCService.AddPC(NewPC)) { return true; } return false; }
public ActionResult Edit(int? id) { if (id == null) { return RedirectToAction("Index", "PC"); } else { PC editPC = new PC(); editPC = PCService.GetEditPCByID(id.Value); ViewBag.pc = editPC; ViewBag.netcafe = PCService.GetNetCafeByID(editPC.NetCafeID); } return View(); }
public SubStateCharSelectSpell(SubStateAbstract theparent, SpellAbstract theSpell, PC thePC) : base(theparent) { spell = theSpell; curr = thePC; int i = 0, alive = 0; for (i = 0; i < StateCombat.MonsterList.Length; i++) if (StateCombat.MonsterList[i].Health > 0) alive++; StateHandler.AddDelay(); messageBoxes = new MessageBox[1]; colors = new Color[3 + alive]; menu = new string[colors.Length]; targets = new Character[colors.Length]; int unavailable = 0; for (i = 0; i < StateCombat.MonsterList.Length; i++) { if (StateCombat.MonsterList[i].Health < 1) unavailable++; else targets[i - unavailable] = StateCombat.MonsterList[i]; } int index = 0; for(i = i - unavailable; i < targets.Length; i++, index++) targets[i] = StateHandler.GetPC(index); for (i = 0; i < menu.Length; i++) menu[i] = targets[i].Name; for (i = 1; i < colors.Length; i++) colors[i] = Color.DarkGray; colors[0] = Color.White; mX = 250; mY = 100; width = 690; height = 510; messageBoxes[0] = new MessageBox(mX, mY, width, height, menu, colors, true, true); }
public Boolean EditPC(PC editPC) { IRepository<PC> repository = new PCRepository(); PC pc = repository.findById(editPC.PCID); if (pc == null) { return false; } try { repository.Update(pc); } catch (Exception e) { e.GetBaseException(); return false; } return true; }
public Boolean AddPC(PC addPC) { PCRepository repository = new PCRepository(); if (repository.findByName(addPC.PCName)) { return false; } else { try { repository.Add(addPC); } catch (Exception e) { e.GetHashCode(); return false; } return true; } }
public InGame(int race) { SoundManager.Stop(); Players[0] = new PC(race); PlayerList.AddFirst(Players[0]); HUDs[0] = new HUD(Players[0], HUD.Corner.TOPLEFT); Map = new ObliqueMap(@"maps\testmap.xml", CastleSpire.BaseWidth, CastleSpire.BaseHeight); Lightmap = new LightMap(CastleSpire.BaseWidth, CastleSpire.BaseHeight); FloorItems = new LinkedList<Item>(); TotalLosOverlay = new RenderTarget2D(Renderer.GraphicsDevice, CastleSpire.BaseWidth, CastleSpire.BaseHeight); LosTemp = new Color[CastleSpire.BaseWidth * CastleSpire.BaseHeight]; PlayerLosOverlay = new Texture2D[4]; for (int i = 0; i != 4; i++) { PlayerLosOverlay[i] = new Texture2D(Renderer.GraphicsDevice, CastleSpire.BaseWidth, CastleSpire.BaseHeight); } L = new Light(.1f, .1f, .2f, 50, 50, 50); Lightmap.AddLight(L); Lightmap.AddLight(new Light(.1f, .0f, .0f, 300, 100, 100)); Lightmap.AddLight(new Light(.0f, .0f, .1f, 400, 200, 100)); Lightmap.AddLight(new Light(.0f, .1f, .0f, 500, 300, 100)); Lightmap.AddLight(new Light(.3f, .0f, .3f, 100, 100, 50)); Lightmap.AddLight(new Light(.3f, .3f, .0f, 200, 150, 50)); Lightmap.AddLight(new Light(.0f, .3f, .3f, 300, 200, 50)); Lightmap.AddLight(new Light(.5f, .5f, .5f, 300, 600, 70)); Clock = new Clock(); FloorItems.AddFirst(new Item(@"items\melee\axe.xml",300,300)); SoundManager.Play("night.ogg", true); }
public override void SetPCAction(PC pc) { pc.SetAction(new PCActionCloseAttack()); AttackSpeed = 0; }
abstract public void SetPCAction(PC pc);
abstract public void UnsetPCAction(PC pc);
public void SetPC(PC pc) { this.pc = pc; }
public override void LoadContent() { base.LoadContent(); string json = System.IO.File.ReadAllText("Levels\\" + mLevelID + ".txt"); List<object> output = JsonParser.Parse(json); Hashtable level = (Hashtable)output[0]; //Level Name mLevelName = (string)level["name"]; //Gravity mGravity = new Vector2((float)((List<object>)level["Gravity"])[0], (float)((List<object>)level["Gravity"])[1]); //Starting Positions foreach(List<object> pos in (List<object>)level["starting_positions"]) { mStartingPositions.Add(mStartingPositions.Count, new Vector2((float)pos[0], (float)pos[1])); } //Create the camera mCamera = new Camera2D(ScreenManager.GraphicsDevice); //Create the world mWorld = new World(mGravity); //Save starting poition index mStartingPositionIndex = 0; //Save starting position mStartingPosition = mStartingPositions[mStartingPositionIndex]; //Get the content manager mContentManager = new ContentManager(ScreenManager.Game.Services, "Content"); //Create the player mPlayer = new Player(mWorld, this, mContentManager, Color.White, mStartingPosition); mCamera.EnableTracking = true; mCamera.EnablePositionTracking = true; mCamera.TrackingBody = mPlayer.CamBody; mCamera.Jump2Target(); //Create a test PC mTestPC = new PC(mWorld, this, mContentManager, Color.White, mStartingPosition); //Create level objects foreach(object dobj in (List<object>)level["Objects"]) { Hashtable dict = (Hashtable)dobj; if (dict["Type"].Equals("Body")) { Body nBody; Hashtable properties = (Hashtable)dict["Properties"]; string SpriteClass = (string)properties["SpriteClass"]; if (SpriteClass != "" && SpriteClass != null) { nBody = BodyFactory.CreateBody(mWorld, new Vector2((float)((List<object>)properties["Position"])[0], (float)((List<object>)properties["Position"])[1])); } else { nBody = BodyFactory.CreateBody(mWorld, new Vector2((float)((List<object>)properties["Position"])[0], (float)((List<object>)properties["Position"])[1])); } string nTextureName = (string)properties["SpriteTexture"]; MaterialType nMaterialType = (MaterialType)Enum.Parse(typeof(MaterialType), (string)properties["MaterialType"]); Color nColor = (Color)Color.White.GetType().GetProperty((string)properties["Color"]).GetValue(null, null); nBody.Position = new Vector2((float)((List<object>)properties["Position"])[0], (float)((List<object>)properties["Position"])[1]); nBody.Rotation = (float)properties["Rotation"]; nBody.BodyType = (BodyType)Enum.Parse(typeof(BodyType), (string)properties["BodyType"]); nBody.IsBullet = (bool)properties["IsBullet"]; nBody.IsSensor = (bool)properties["IsSensor"]; nBody.IsStatic = (bool)properties["IsStatic"]; nBody.Mass = (float)properties["Mass"]; nBody.Inertia = (float)properties["Inertia"]; nBody.Friction = (float)properties["Friction"]; nBody.Restitution = (float)properties["Restitution"]; nBody.LinearDamping = (float)properties["LinearDamping"]; nBody.AngularDamping = (float)properties["AngularDamping"]; nBody.FixedRotation = (bool)properties["FixedRotation"]; nBody.Awake = (bool)properties["Awake"]; nBody.Enabled = (bool)properties["Enabled"]; nBody.IgnoreCCD = (bool)properties["IgnoreCCD"]; nBody.IgnoreGravity = (bool)properties["IgnoreGravity"]; nBody.SleepingAllowed = (bool)properties["SleepingAllowed"]; foreach(object fobj in (List<object>)dict["Fixtures"]) { Hashtable fixture = (Hashtable)fobj; if(fixture["Shape"].Equals("Rectangle")) { FixtureFactory.AttachRectangle((float)fixture["Width"], (float)fixture["Height"], (float)fixture["Density"], new Vector2((float)((List<object>)fixture["Offset"])[0], (float)((List<object>)fixture["Offset"])[1]), nBody); } else if(fixture["Shape"].Equals("Circle")) { FixtureFactory.AttachCircle((float)fixture["Radius"], (float)fixture["Density"], nBody, new Vector2((float)((List<object>)fixture["Offset"])[0], (float)((List<object>)fixture["Offset"])[1])); } else if(fixture["Shape"].Equals("Ellipse")) { FixtureFactory.AttachEllipse((float)fixture["xRadius"], (float)fixture["yRadius"], (int)fixture["Edges"], (float)fixture["Density"], nBody); } } AddObject(nBody, nMaterialType, nColor, nTextureName); } else if (dict["Type"].Equals("Fixture")) { Hashtable properties = (Hashtable)dict["Properties"]; Body nBody = null; if(properties["Shape"].Equals("Rectangle")) { nBody = BodyFactory.CreateRectangle(mWorld, (float)properties["Width"], (float)properties["Height"], (float)properties["Density"]); } else if(properties["Shape"].Equals("Circle")) { nBody = BodyFactory.CreateCircle(mWorld, (float)properties["Radius"], (float)properties["Density"]); } else if(properties["Shape"].Equals("Ellipse")) { nBody = BodyFactory.CreateEllipse(mWorld, (float)properties["xRadius"], (float)properties["yRadius"], (int)properties["Edges"], (float)properties["Density"]); } string SpriteClass = (string)properties["SpriteClass"]; string nTextureName = (string)properties["SpriteTexture"]; MaterialType nMaterialType = (MaterialType)Enum.Parse(typeof(MaterialType), (string)properties["MaterialType"]); Color nColor = (Color)Color.White.GetType().GetProperty((string)properties["Color"]).GetValue(null, null); nBody.Position = new Vector2((float)((List<object>)properties["Position"])[0], (float)((List<object>)properties["Position"])[1]); nBody.Rotation = (float)properties["Rotation"]; nBody.BodyType = (BodyType)Enum.Parse(typeof(BodyType), (string)properties["BodyType"]); nBody.IsBullet = (bool)properties["IsBullet"]; nBody.IsSensor = (bool)properties["IsSensor"]; nBody.IsStatic = (bool)properties["IsStatic"]; nBody.Mass = (float)properties["Mass"]; nBody.Inertia = (float)properties["Inertia"]; nBody.Friction = (float)properties["Friction"]; nBody.Restitution = (float)properties["Restitution"]; nBody.LinearDamping = (float)properties["LinearDamping"]; nBody.AngularDamping = (float)properties["AngularDamping"]; nBody.FixedRotation = (bool)properties["FixedRotation"]; nBody.Awake = (bool)properties["Awake"]; nBody.Enabled = (bool)properties["Enabled"]; nBody.IgnoreCCD = (bool)properties["IgnoreCCD"]; nBody.IgnoreGravity = (bool)properties["IgnoreGravity"]; nBody.SleepingAllowed = (bool)properties["SleepingAllowed"]; AddObject(nBody, nMaterialType, nColor, nTextureName); } else if ((dict["Type"].Equals("Custom"))) { Hashtable properties = (Hashtable)dict["Properties"]; BaseSprite nSprite; string SpriteClass = (string)properties["SpriteClass"]; Vector2 nPos = new Vector2((float)((List<object>)properties["Position"])[0], (float)((List<object>)properties["Position"])[1]); if (SpriteClass == "LevelPortal") { nSprite = new LevelPortal(mWorld, this, mContentManager, Color.White, nPos, LevelPortalCollision, (Hashtable)properties["Config"]); } else { nSprite = null; } AddSpecial(nSprite); } } //Attach the debug view DebugView = new DebugViewXNA(mWorld); DebugView.RemoveFlags(DebugViewFlags.Shape); DebugView.RemoveFlags(DebugViewFlags.Joint); DebugView.DefaultShapeColor = Color.White; DebugView.SleepingShapeColor = Color.LightGray; DebugView.LoadContent(ScreenManager.GraphicsDevice, ScreenManager.Content); //Reset time elapsed to account for loading time ScreenManager.Game.ResetElapsedTime(); }
public PlayCommand(PC pc) { this.pc = pc; }
private static void InitializeComputers() { var manufacturer = Console.ReadLine(); if (manufacturer == "HP") { // pc var ram = new RamMemory(2); var videoCard = VideoCardFactory.CrateVideoCard(VideoCardType.COLORFUL); var motherboard = new Motherboard(videoCard, ram); var cpu = new Cpuu.Cpu(2, CpuType.BIT32, motherboard); pc = new PC(cpu, motherboard, new HardDriver(500, false, 0)); var serverRam = new RamMemory(32); var serverVideo = VideoCardFactory.CrateVideoCard(VideoCardType.MONOCHROME); var serverMBoard = new Motherboard(serverVideo, serverRam); var serverCpu = new Cpu(4, CpuType.BIT32, serverMBoard); server = new Server(serverCpu, serverMBoard, new[] { new HardDriver(1000, true, 2) }); var ramLaptop = new RamMemory(4); var videoCardLaptop = VideoCardFactory.CrateVideoCard(VideoCardType.COLORFUL); var motherboardLaptop = new Motherboard(videoCardLaptop, ram); var cpuLaptop = new Cpuu.Cpu(2, CpuType.BIT64, motherboard); laptop = new Laptop(cpu, motherboard, new HardDriver(500, false, 0), new ComputerBuildingSystem.Computerr.LaptopBattery()); } else if (manufacturer == "Dell") { // pc var ram = new RamMemory(8); var videoCard = VideoCardFactory.CrateVideoCard(VideoCardType.COLORFUL); var motherboard = new Motherboard(videoCard, ram); var cpu = new Cpuu.Cpu(2, CpuType.BIT64, motherboard); pc = new PC(cpu, motherboard, new HardDriver(1000, false, 0)); var serverRam = new RamMemory(64); var serverVideo = VideoCardFactory.CrateVideoCard(VideoCardType.MONOCHROME); var serverMBoard = new Motherboard(serverVideo, serverRam); var serverCpu = new Cpu(8, CpuType.BIT64, serverMBoard); server = new Server(serverCpu, serverMBoard, new[] { new HardDriver(2000, true, 2) }); var ramLaptop = new RamMemory(8); var videoCardLaptop = VideoCardFactory.CrateVideoCard(VideoCardType.COLORFUL); var motherboardLaptop = new Motherboard(videoCardLaptop, ram); var cpuLaptop = new Cpuu.Cpu(2, CpuType.BIT32, motherboard); laptop = new Laptop(cpu, motherboard, new HardDriver(1000, false, 0), new ComputerBuildingSystem.Computerr.LaptopBattery()); } else { throw new InvalidArgumentException("Invalid manufacturer!"); } }
private void Start() { pc = GetComponent<PC>(); }
public new void Awake() { // Debug.Log( "***PC - Awake***" ); base.Awake(); instance = this; }
private void Awake() { Instance = this; pc = GameObject.Find("Carp").GetComponent<PC>(); }
public new void Awake() { base.Awake(); instance = this; }
public abstract void GetAllProducts(out PC pc, out Server server, out Laptop laptop);
public override void UnsetPCAction(PC pc) { pc.SetAction(new PCActionJump()); }
private void Raycast(PC p, Color[] losData, int cameraX, int cameraY) { int playerX = p.X + (p.Size / 2); int playerY = p.Y + (p.Size / 2); //for top int destY = cameraY; for (int ddestX = cameraX; ddestX != cameraX + CastleSpire.BaseWidth; ddestX++) { RaycastLinear(playerX, playerY, ddestX, destY, cameraX, cameraY, losData); } //for bottom destY = cameraY + CastleSpire.BaseHeight; for (int ddestX = cameraX; ddestX != cameraX + CastleSpire.BaseWidth; ddestX++) { RaycastLinear(playerX, playerY, ddestX, destY, cameraX, cameraY, losData); } //for left int destX = cameraX; for (int ddestY = cameraY; ddestY != cameraY + CastleSpire.BaseHeight; ddestY++) { RaycastLinear(playerX, playerY, destX, ddestY, cameraX, cameraY, losData); } //for right destX = cameraX + CastleSpire.BaseWidth; for (int ddestY = cameraY; ddestY != cameraY + CastleSpire.BaseHeight; ddestY++) { RaycastLinear(playerX, playerY, destX, ddestY, cameraX, cameraY, losData); } }