public void UpdateView(Scene s) { transition.UpdateTransition(Time.Delta() * 2); if (Input.CloseKeyPressed) { game.SetView(game.PauseMenu); } game.GameStats.PlayerInventory.HandleInput(); }
public void UpdateView(Scene s) { transition.UpdateTransition(Time.Delta() * 2f); if (Input.CloseKeyPressed) { OnTableNotUsed(); game.SetView(parentView); return; } if (Input.InteractKeyPressed | Input.MousePressed & Input.OrthoMouseX > OrthoRenderEngine.GetCanvasWidth() - 300 & Input.OrthoMouseX < OrthoRenderEngine.GetCanvasWidth() - 50 & Input.OrthoMouseY > 50 & Input.OrthoMouseY < 300) { game.SetView(anvil); anvil.OnAnvilUsed(parentView, blade, heat, diamond); OnTableNotUsed(); return; } if (Input.UpKeyPressed & diamond < blade.Type.Points.Length - 1) { diamond++; } else if (Input.DownKeyPressed & diamond >= 0) { diamond--; } if (Input.LeftKey) { panAngle -= (panAngle + 0.4f) * Time.Delta() * 3; } else if (Input.RightKey) { panAngle -= (panAngle - 0.4f) * Time.Delta() * 3; } else { panAngle -= panAngle * Time.Delta() * 3; } for (int i = 0; i < heat.Length; i++) { if (i != diamond & heat [i] > 25) { heat [i] -= Time.Delta() * 200; } else if (heat [i] < 1927) { heat [i] += Time.Delta() * 100; } } }
public void UpdateView(Scene s) { if (Input.CloseKeyPressed) { game.SetView(prevView); return; } transition.UpdateTransition(Time.Delta() * 2); if (hatchRotation > -1.5f) { hatchSpeed -= Time.Delta() * 8; } else { hatchSpeed -= 4 * hatchSpeed * Time.Delta(); } hatchRotation += hatchSpeed * Time.Delta(); game.GameStats.PlayerInventory.HandleInput(); if (game.GameStats.PlayerInventory.HasSelectedItem()) { game.GameStats.HatchInv.AddItem(game.GameStats.PlayerInventory.GetSelectedItem()); game.GameStats.PlayerInventory.RemoveItem(game.GameStats.PlayerInventory.GetSelectedItemIndex()); } Inventory playerInv = game.GameStats.PlayerInventory; HatchInventory hatchInv = game.GameStats.HatchInv; float x = inventoryXPos; float y = inventoryYPos; if (Input.OrthoMouseX > x & Input.OrthoMouseY > y & Input.OrthoMouseX < x + iconSize * iconsPerRow & Input.OrthoMouseY < y + iconSize * iconsPerRow) { int xIndex = (int)(Input.OrthoMouseX - x) / (int)iconSize; int yIndex = (int)(Input.OrthoMouseY - y) / (int)iconSize; int iconIndex = yIndex + xIndex * iconsPerRow; uint box = 0; uint yPos = 0; uint xPos = 0; for (hoveredItem = 0; hoveredItem < hatchInv.GetItemAmount(); hoveredItem++) { box += hatchInv.GetItem(hoveredItem).GetSize(); yPos += hatchInv.GetItem(hoveredItem).GetSize(); if (yPos > iconsPerRow) { yPos = 0; xPos++; box = xPos * iconsPerRow + hatchInv.GetItem(hoveredItem).GetSize(); } if (iconIndex < box - hatchInv.GetItem(hoveredItem).GetSize()) { hoveredItem = -1; break; } if (box > iconIndex) { break; } } if (hoveredItem < hatchInv.GetItemAmount() & Input.MousePressed) { Item item = hatchInv.GetItem(hoveredItem); if (playerInv.CanFitItem(item)) { playerInv.AddItem(item); hatchInv.RemoveItem(hoveredItem); } else { playerInv.InventoryTooFull(item); } } } else { hoveredItem = -1; } }
public void UpdateView(Scene s) { transition.UpdateTransition(Time.Delta() * 2); if (Input.CloseKeyPressed) { OnAnvilNotUsed(); game.SetView(parentView); return; } if (Input.InteractKeyPressed | Input.MousePressed & Input.OrthoMouseX > 50 & Input.OrthoMouseX < 300 & Input.OrthoMouseY > 50 & Input.OrthoMouseY < 300) { game.SetView(table); table.OnTableUsed(heat, blade); OnAnvilNotUsed(); return; } for (int i = 0; i < heat.Length; i++) { if (heat[i] > 25) { heat [i] -= Time.Delta() * (i == diamond? 100 : 200); } } if (!hammerDown && Input.MousePressed & hammerMove <0.3f& Input.OrthoMouseX> OrthoRenderEngine.GetCanvasWidth() / 2 - 100 & Input.OrthoMouseX <OrthoRenderEngine.GetCanvasWidth() / 2 + 100 & Input.OrthoMouseY> OrthoRenderEngine.GetCanvasHeight() / 2 - 70 & Input.OrthoMouseY < OrthoRenderEngine.GetCanvasHeight() / 2 + 70) { hammerDown = true; hammerX = Util.NextFloat() - 0.5f; hammerY = Util.NextFloat() - 0.5f; } if (hammerDown) { if (hammerMove < 1) { hammerMove += Time.Delta() * 10; if (hammerMove >= 1) { hammerDown = false; hammerMove = 1; if (diamond >= 0) { blade.Sharpness [diamond] = Math.Min(1, blade.Sharpness [diamond] + KnownMetal.GetRedEmmission(blade.Metal, heat[diamond]) * 0.01f * (1 - blade.Sharpness [diamond])); blade.UpdateSharpnessMap(); } } } } else if (hammerMove > 0) { hammerMove = Math.Max(0, hammerMove - Time.Delta() * 4); } if (Input.LeftKey) { panAngle -= (panAngle + 0.6f) * Time.Delta() * 3; } else if (Input.RightKey) { panAngle -= (panAngle - 0.6f) * Time.Delta() * 3; } else { panAngle -= panAngle * Time.Delta() * 3; } if (Input.DownKey) { panAngleY -= (panAngleY + 0.3f) * Time.Delta() * 3; } else if (Input.UpKey) { panAngleY -= (panAngleY - 0.28f) * Time.Delta() * 3; } else { panAngleY -= panAngleY * Time.Delta() * 3; } }