private void CreateGroundPlane(Vector3 position) { hitTestGroundPlane = new Plane(Vector3.up, position); groundPlane = Instantiate(planePrefab, position, Quaternion.identity); groundPlane.shapes.Clear(); groundPlane.shapes.Add(new Shape()); }
// Start is called before the first frame update void Start() { instance = this; PlayerController.instance.OnRunStartEvent += RunStart; PlayerController.instance.OnRunStopEvent += RunStop; }
public void init() { sunLight = new LightSun(new Vector3(0.1f, 0.125f, 0.2f) * 3f, this); sunLight.lightAmbient = new Vector3(0.1f, 0.125f, 0.2f) * 0.5f;//new Vector3(0.2f, 0.125f, 0.1f);//new Vector3(0.1f, 0.14f, 0.3f); sunLight.PointingDirection = Vector3.Normalize(new Vector3(674, -674, 1024)); sunFrameBuffer = gameWindow.framebufferCreator.createFrameBuffer("shadowFramebuffer", shadowRes * 2, shadowRes * 2, PixelInternalFormat.Rgba8, false); sunInnerFrameBuffer = gameWindow.framebufferCreator.createFrameBuffer("shadowFramebuffer", shadowRes * 2, shadowRes * 2, PixelInternalFormat.Rgba8, false); mFilter2d = new Quad2d(this); mSkyModel = new Skybox(this, gameWindow); mGroundPlane = new GroundPlane(this); mGroundPlane.setMaterial("floor.xmf"); mGroundPlane.setMesh("water_plane.obj"); mGroundPlane.setMaterial("floor.xmf"); //need to be fixed -- cant be executed after voxel Manager creation. if (Settings.Instance.video.Particles) { generateParticleSys(); } voxelManager = new VoxelManager(this); compositeMod.X = Settings.Instance.video.gamma; particleAffectors.Add(new ParticleAffectorWind(new Vector3(1, -0.5f, 0) * 0.01f)); particleAffectors.Add(new ParticleAffectorFriction(0.1f)); particleAffectors.Add(new ParticleAffectorFloorKiller(waterLevel)); particleAffectors.Add(new ParticleAffectorLifeTimeKiller(this)); /* * waterModel.setTextures(mTextureLoader.fromMixed(new int[]{ * TextureGroup.TYPE_FRAMEBUFFER, * TextureGroup.TYPE_FROMFILE}, * new string[] { * Convert.ToString(waterFramebuffer.ColorTexture), * "noise.png"})); */ mGroundPlane.Position = new Vector3(0, waterLevel, 0); //mGroundPlane.updateModelMatrix(); Matrix4 translate = Matrix4.CreateTranslation(0, -waterLevel * 2, 0); Matrix4 invert = Matrix4.Scale(1, -1, 1); Matrix4.Mult(ref translate, ref invert, out mWaterMatrix); }
protected override void LoadContent() { groundPlane = new GroundPlane(graphicsDeviceManager.GraphicsDevice, Content, "ch18p1_GroundTexture", 256.0f, 256.0f, 8); ShowGround = true; particleSystem = new ParticleEmitter(Content, graphicsDeviceManager.GraphicsDevice) { Position = new Vector3(0.0f, 1.0f, 0.0f) }; particleSystem.Compile(particleSystemDescription); particleSystem.LoadContent(Content, graphicsDeviceManager.GraphicsDevice); particleSystem.Start(); base.LoadContent(); }
private void OnDirectionInput(Vector2Int direction) { Level level = GameManager.instance.Level; if (level != null) { Character = level.ChosenCharacter; if (Character != null && !level.Win) { Vector3Int worldDirection = GroundPlane.CameraRelativeDirectionToWorldCardinalDirection( new Vector3(direction.x, 0.0f, direction.y), GameManager.instance.Camera); if (Character.TryMove(worldDirection)) { level.CommitToUndoHistory(); } } } }
public static void onStart() { // Create objects! SimGroup gameGroup = new SimGroup("GameGroup"); gameGroup.Name = "GameGroup"; gameGroup.registerObject(); LevelInfo levelInfo = new LevelInfo("TheLevelInfo") { CanvasClearColor = new ColorI(0, 0, 0, 0) }; levelInfo.registerObject(); GroundPlane groundPlane = new GroundPlane("TheGround") { Position = Point3F.Zero, Material = "BlankWhite" }; groundPlane.registerObject(); Sun sun = new Sun("TheSun") { Azimuth = 230, Elevation = 45, Color = ColorF.WHITE, Ambient = new ColorF(0.1f, 0.1f, 0.1f, 1), CastShadows = true }; sun.registerObject(); gameGroup.add(levelInfo, groundPlane, sun); // Allow us to exit the game... ActionMap globalActionMap = Sim.FindObjectByName <ActionMap>("GlobalActionMap"); globalActionMap.bindCmd("keyboard", "escape", "quit"); }