static void Main() { using (var game = new GenericGame()) { game.Run(); } }
public GenericGame GetCurrentGameMode() { GenericGame gameMode = null; if (currentGameMode != GameType.none) { gameMode = gameModes[((int)currentGameMode) - 1]; } return(gameMode); }
public void GameTest() { Form form = new Form(); GenericGame game = new GenericGame(); Assert.IsInstanceOfType(game, typeof(GenericGame)); //passes IFactory SmurfFactory = new SmurfFactory(); Assert.IsInstanceOfType(SmurfFactory, typeof(SmurfFactory)); //passes IFactory MinionFactory = new MinionFactory(); Assert.IsInstanceOfType(MinionFactory, typeof(MinionFactory)); IFigure SFigure = new Smurf(); IHouse SHouse = new HouseSmurf(); IFemale SFemale = new Smurfin(); IFood SFood = new FoodSmurf(); Assert.IsInstanceOfType(SFigure, typeof(IFigure)); //passes Assert.IsInstanceOfType(SHouse, typeof(IHouse)); //passes Assert.IsInstanceOfType(SFemale, typeof(IFemale)); //passes Assert.IsInstanceOfType(SFood, typeof(IFood)); //passes IFigure MFigure = new Minion(); IHouse MHouse = new HouseMinion(); IFemale MFemale = new MinionFemale(); IFood MFood = new FoodMinion(); Assert.IsInstanceOfType(MFigure, typeof(IFigure)); //passes Assert.IsInstanceOfType(MHouse, typeof(IHouse)); //passes Assert.IsInstanceOfType(MFemale, typeof(IFemale)); //passes Assert.IsInstanceOfType(MFood, typeof(IFood)); //passes }
private void LateUpdate() { int rayCount = 50; float angle = startingAngle; float angleIncrease = fov / rayCount; Vector3[] vertices = new Vector3[rayCount + 1 + 1]; Vector2[] uv = new Vector2[vertices.Length]; int[] triangles = new int[rayCount * 3]; vertices[0] = origin; int vertexIndex = 1; int triangleIndex = 0; for (int i = 0; i <= rayCount; i++) { Vector3 vertex; RaycastHit2D raycastHit2D = Physics2D.Raycast(origin, GenericGame.GetVectorFromAngle(angle), viewDistance, layerMask); if (raycastHit2D.collider == null) { // No hit object vertex = origin + GenericGame.GetVectorFromAngle(angle) * viewDistance; } else { // Hit object vertex = raycastHit2D.point; if (raycastHit2D.collider.gameObject.name == "Player") { playerHasFound = true; } } vertices[vertexIndex] = vertex; if (i > 0) { triangles[triangleIndex + 0] = 0; triangles[triangleIndex + 1] = vertexIndex - 1; triangles[triangleIndex + 2] = vertexIndex; triangleIndex += 3; } vertexIndex++; angle -= angleIncrease; } if (playerHasFound) { followThePlayer = true; playerHasFound = false; } else { followThePlayer = false; } mesh.vertices = vertices; mesh.uv = uv; mesh.triangles = triangles; }
public void SetAimDirection(Vector3 aimDirection) { // Somando 90 por conta das posições do mapa startingAngle = GenericGame.GetAngleFromVectorFloat(aimDirection) - fov / 2 + fov; }