public Bomb(TerrainRenderer terrain, ContentManager Content, Camera camera, GraphicsDevice graphicsDevice, Light light, Player player) : base(terrain, Content, camera, graphicsDevice, light) { Terrain = terrain; path = null; sphereCollider = new SphereCollider(); Player = player; search = new AStarSearch(gridSize, gridSize); float gridW = Terrain.size.X / gridSize; float gridH = Terrain.size.Y / gridSize; for (int i = 0; i < gridSize; i++) { for (int j = 0; j < gridSize; j++) { Vector3 pos = new Vector3(gridW * j + gridW / 2 - terrain.size.X / 2, 0, gridH * i + gridH / 2 - terrain.size.Y / 2); if (Terrain.GetAltitude(pos) > 1.0) { search.Nodes[i, j].Passable = false; } } } time = 0; start = false; end = false; }
public Agent(TerrainRenderer terrain, ContentManager Content, Camera camera, GraphicsDevice graphicsDevice, Light light, Random random) : base() { Terrain = terrain; Rigidbody rigidbody = new Rigidbody(); rigidbody.Transform = Transform; rigidbody.Mass = 1; Add <Rigidbody>(rigidbody); Texture2D texture = Content.Load <Texture2D>("Square"); Renderer renderer = new Renderer(Content.Load <Model>("Sphere"), Transform, camera, Content, graphicsDevice, light, 1, "SimpleShading", 20f, texture); Add <Renderer>(renderer); SphereCollider sphereCollider = new SphereCollider(); sphereCollider.Radius = 1.0f; sphereCollider.Transform = Transform; Add <Collider>(sphereCollider); path = null; this.random = random; float gridW = Terrain.size.X / gridSize; float gridH = Terrain.size.Y / gridSize; search = new AStarSearch(gridSize, gridSize); // size of grid for (int i = 0; i < gridSize; i++) { for (int j = 0; j < gridSize; j++) { Vector3 pos = new Vector3(gridW * i + gridW / 2 - Terrain.size.X / 2, 0, gridH * j + gridH / 2 - Terrain.size.Y / 2); if (Terrain.GetAltitude(pos) > 1.0) { search.Nodes[j, i].Passable = false; } } } }
public Agent(TerrainRenderer terrain, ContentManager Content, Camera camera, GraphicsDevice graphicsDevice, Light light) : base() { Terrain = terrain; path = null; search = new AStarSearch(gridSize, gridSize); float gridW = Terrain.size.X / gridSize; float gridH = Terrain.size.Y / gridSize; for (int i = 0; i < gridSize; i++) { for (int j = 0; j < gridSize; j++) { Vector3 pos = new Vector3(gridW * i + gridW / 2 - terrain.size.X / 2, gridH * i + gridW / 2 - terrain.size.X / 2, 0); if (Terrain.GetAltitude(pos) > 1.0) { search.Nodes[i, j].Passable = false; } } } Rigidbody rigidbody = new Rigidbody(); rigidbody.Transform = Transform; rigidbody.Mass = 1; Add <Rigidbody>(rigidbody); Texture2D texture = Content.Load <Texture2D>("Square"); Renderer renderer = new Renderer(Content.Load <Model>("Torus"), Transform, camera, light, Content, graphicsDevice, 1, 20f, texture, null); Add <Renderer>(renderer); SphereCollider sphereCollider = new SphereCollider(); sphereCollider.Radius = renderer.ObjectModel.Meshes[0].BoundingSphere.Radius; sphereCollider.Transform = Transform; Add <Collider>(sphereCollider); Transform.LocalScale = Vector3.One * 2; }