public Carrier() : base() { Color carrierColor = Color.Red; this.AddComponent(new CarrierController()); ProceduralShape body = new ProceduralCuboid(1f, 2f, 0.5f); body.SetColor(carrierColor); RenderGeometryComponent renderGeom = new RenderGeometryComponent(body); EffectRenderComponent effectComp = new EffectRenderComponent(EffectLoader.LoadSM5Effect("flatshaded")); ShadowCasterComponent shadowComp = new ShadowCasterComponent(); AddComponent(new PhysicsComponent(true, true, PhysicsMeshType.box)); AddComponent(renderGeom); AddComponent(effectComp); AddComponent(shadowComp); var conTower = new ProceduralCuboid(0.25f, 0.25f, 0.35f); conTower.SetColor(carrierColor); GameObject conT = GameObjectFactory.CreateRenderableGameObjectFromShape(conTower, EffectLoader.LoadSM5Effect("flatshaded")); conT.Transform.RelativeTransform.Translation = new Vector3(0.8f, 0.8f, 0); conT.AddComponent(new ShadowCasterComponent()); SystemCore.GameObjectManager.AddAndInitialiseGameObject(conT); AddChild(conT); }
public Chopper() : base("chopper") { Color chopperColor = Color.Red; this.AddComponent(new ChopperController()); ProceduralShape body = new ProceduralCuboid(0.15f, 0.3f, 0.15f); body.SetColor(chopperColor); RenderGeometryComponent renderGeom = new RenderGeometryComponent(body); EffectRenderComponent effectComp = new EffectRenderComponent(EffectLoader.LoadSM5Effect("flatshaded")); ShadowCasterComponent shadowComp = new ShadowCasterComponent(); AddComponent(new PhysicsComponent(true, true, PhysicsMeshType.box)); AddComponent(renderGeom); AddComponent(effectComp); AddComponent(shadowComp); var rotorCuboid = new ProceduralCuboid(0.03f, 0.6f, 0.03f); rotorCuboid.SetColor(chopperColor); GameObject rotor = GameObjectFactory.CreateRenderableGameObjectFromShape(rotorCuboid, EffectLoader.LoadSM5Effect("flatshaded")); rotor.Transform.RelativeTransform.Translation = new Vector3(0, 0.2f, 0); rotor.AddComponent(new RotatorComponent(Vector3.Up, 0.1f)); rotor.AddComponent(new ShadowCasterComponent()); SystemCore.GameObjectManager.AddAndInitialiseGameObject(rotor); AddChild(rotor); }
public GameObject.GameObject CreateTranslatedRenderableHeightMap(Color color, Effect effect, Vector3 translation) { var vertexArray = GenerateVertexArray(translation.X, translation.Y, translation.Z); var indexArray = GenerateIndices(); GameObject.GameObject heightMapObject = new GameObject.GameObject(); ProceduralShape shape = new ProceduralShape(vertexArray, indexArray); shape.SetColor(color); RenderGeometryComponent renderGeom = new RenderGeometryComponent(shape); EffectRenderComponent renderComponent = new EffectRenderComponent(effect); heightMapObject.AddComponent(renderGeom); heightMapObject.AddComponent(renderComponent); heightMapObject.AddComponent(new StaticMeshColliderComponent(heightMapObject, GetVertices(), GetIndices().ToArray(), Vector3.Zero)); return(heightMapObject); }