public AsteroidObject() { SphereCollider s = new SphereCollider(); s.Radius = 3; addBehavior(s); addBehavior(new Astroid()); addBehavior(new Rigidbody()); mesh = AstroidModel; transform.LocalScale = Vector3.One * 3; StandardLightingMaterial m = new StandardLightingMaterial(); m.texture = tex; m.ambientColor = Vector3.Zero; m.useTexture = true; material = m; }
// Static method for creating new enemies public static GameObject3d createEnemy(GameObject3d player) { GameObject3d g = GameObject3d.Initialize(); Enemy e = new Enemy(player); g.addBehavior(e); g.mesh = enemyModel; g.material = new StandardLightingMaterial(); (g.material as StandardLightingMaterial).diffuseColor = Vector3.Up; //SETUPSEARCH int size = 100; e.search = new AStarSearch(size, size); // size of grid // use heightmap foreach (AStarNode node in e.search.Nodes) { node.Passable = (terrain.GetAltitude(node.Position) < 0.5); } //****** GameObject3d child = GameObject3d.Initialize(); child.transform.LocalPosition = g.transform.LocalPosition; child.transform.LocalPosition += Vector3.Forward; child.transform.LocalScale *= 0.5f; child.transform.Parent = g.transform; e.heldObject = child; child.mesh = enemyModel; StandardLightingMaterial s = new StandardLightingMaterial(); s.ambientColor = Vector3.Down; child.material = s; g.transform.LocalScale = Vector3.One * 2; e.reposition(); return(g); }