public CollisionTransform(CollisionSkin collision, Scene scene) { this.scene = scene; this.collision = collision; this.collisionTransform = new JigLibX.Math.Transform(position, worldMatrix); this.oldTransform = collisionTransform; }
public GasStation(Scene scene) { Model gasStation = new Model("GasStation"); (scene.MainTerrain as TerrainVoxel).GetLandmarkTransform(MapLandmark.GasStation, gasStation.Transformation, gasStation.GetMesh().GetBounds()); //powerPlant.Transformation.SetPosition(powerPlant.Transformation.GetPosition()-Vector3.Up*94); Vector3 pos = gasStation.Transformation.GetPosition(); gasStationTransform = gasStation.Transformation; AnimationNode[] nodes = gasStation.GetMesh().GetNodes(); Matrix worldMatrix = gasStation.Transformation.GetTransform(); SafeTrigger campTrigger = new SafeTrigger(); campTrigger.Transformation.SetPosition(gasStation.Transformation.GetPosition()); campTrigger.Transformation.SetScale(Vector3.One * 30); scene.AddEntity("SafeTrigger", campTrigger); //Vector3 meshCenter = 0.5f * (gasStation.GetMesh().GetBounds().Max + gasStation.GetMesh().GetBounds().Min); for (int i = 0; i < nodes.Length; i++) { InteractObject gasTank = new InteractObject(null, "GasTank"); gasTank.SetInteractNode(new GasTankNode(gasTank)); Vector3 gasTankPos = Vector3.Transform(nodes[i].Translation, worldMatrix); gasTank.Transformation.SetPosition(gasTankPos); gasTank.Transformation.SetRotation(gasStation.Transformation.GetRotation()); scene.AddEntity("GasTank", gasTank); } scene.AddEntity("GasStation", gasStation); }
public virtual void Initialize(LevelEditor editor, string name) { this.editor = editor; this.scene = editor.GetScene(); this.name = name; this.target = scene.FindEntity(name); }
public override void OnAdd(Scene scene) { this.scene = scene; this.interactTrigger.OnAdd(scene); if (useCollisionTransform) { Transform oldTransform = Transformation; if (mesh.GetCollisionMesh() != null) { collision = new CollisionSkin(null); collision.AddPrimitive(mesh.GetCollisionMesh(), (int)MaterialTable.MaterialID.NotBouncyRough); scene.GetPhysicsEngine().CollisionSystem.AddCollisionSkin(collision); } Transformation = new CollisionTransform(this.collision, scene); Transformation.SetPosition(oldTransform.GetPosition()); Transformation.SetRotation(oldTransform.GetRotation()); Transformation.SetScale(oldTransform.GetScale()); oldTransform = null; } else base.OnAdd(scene); }
public LevelEditor(Scene scene) { InitializeComponent(); InitializeCreationMenu(); InitializeTypeToolDatabase(); this.scene = scene; Reset(); }
public MainRenderView(Scene scene, Matrix view, Matrix projection, Vector3 position, float nearPlane, float farPlane) : base(RenderViewType.MAIN, view, projection, position, nearPlane, farPlane) { this.scene = scene; InitializeTextures(); InitializeRenderViews(); InitializeManagers(); Name = "MainRenderView" + this.GetHashCode(); }
public override void OnAdd(Scene scene) { base.OnAdd(scene); if (collision != null) { interactBody.CollisionSkin = collision; collision.Owner = interactBody; } }
public Weapon(string modelName, Body body, Transform transform, Scene scene) { this.ignorePred = new IgnoreSkinPredicate(body); this.scene = scene; this.fpsModel = new ViewModel(modelName); fpsModel.SetTransform(transform); Matrix weaponTransform = Matrix.CreateScale(0.1f) * Matrix.CreateRotationX(-MathHelper.PiOver2) * Matrix.CreateRotationY(MathHelper.PiOver2); fpsModel.SetCustomMatrix(weaponTransform); fpsModel.GetAnimationLayer().SetActiveAnimation("Pistol_Idle", true);//.SetAnimationLayer("Pistol_Idle", 1); }
public Weapon(string datablockName, Body body, Transform transform, Scene scene) { this.ignorePred = new IgnoreSkinPredicate(body); this.scene = scene; this.datablock = ResourceManager.Inst.GetWeaponDatablock(datablockName); this.fpsModel = new ViewModel(datablock.MeshName); this.fpsModel.SetRenderAlways(true, scene); this.ammo = datablock.AmmoPerClip; this.ReserveAmmo = datablock.DefaultAmmo; fpsModel.SetTransform(transform); fpsModel.SetCustomMatrix(datablock.CustomMatrix); fpsModel.GetAnimationLayer().SetActiveAnimation(datablock.GetAnimation(WeaponAnimations.Idle), true); }
public VoxelCollision(VoxelGeometry voxel, Transform transform, BoundingBox bounds, Scene scene) { geometry = voxel; transformation = transform; this.scene = scene; boundsWorldSpaceCollision = bounds; boundsWorldSpaceCollision.Min = bounds.Min * 1.5f; boundsWorldSpaceCollision.Max = bounds.Max * 1.5f; if (geometry.CanRender) { //GenerateCollisionMesh(); } }
public SceneRenderView(Scene scene, Matrix view, Matrix projection, Vector3 position, float nearPlane, float farPlane, int width, int height) : base(RenderViewType.REFLECTIONS, view, projection, position, nearPlane, farPlane) { this.width = width; this.height = height; this.scene = scene; this.ElementManagers.Add(RenderPass.Sky, new SkyElementManager(this)); this.ElementManagers.Add(RenderPass.Scene, new SceneElementManager(this)); this.ElementManagers.Add(RenderPass.Light, new LightElementManager(this)); this.ElementManagers.Add(RenderPass.Particles, new ParticleElementManager(this)); this.ElementManagers.Add(RenderPass.PostProcess, new PostProcessReflectionsElementManager(this)); InitializeTextures(); }
public PlayerScreen() : base() { this.scene = new Scene(); compass = new UICompass(); compass.Scale = new Vector2(0.35f, 0.05f); compass.Position = new Vector2(0, -0.85f); crosshair = new UIButton(ResourceManager.Inst.GetTexture("UI/Game/crossHair.dds"), Vector4.One, string.Empty); crosshair.Position = Vector2.Zero; crosshair.Scale = Vector2.One * 0.035f; scoreLabel = new UIButton(null, Vector4.One, "Score:"); scoreLabel.Position = new Vector2(0.7f, 0.85f); journalStatus = new UIButton(null, Vector4.One, "Journal Updated!"); journalStatus.Position = new Vector2(-0.7f, 0.85f); journalStatus.SetVisible(false); interactStatus = new UIButton(null, Vector4.One, "Examine Object"); interactStatus.Position = new Vector2(-0.7f, -0.85f); interactStatus.SetVisible(false); interactButton = new UIButton(ResourceManager.Inst.GetTexture("UI/Game/interact.dds"), Vector4.One, string.Empty); interactButton.Position = crosshair.Position; interactButton.Scale = crosshair.Scale * 1.15f; interactButton.SetVisible(false); list = new UIList(); list.ItemColor = new Vector4(0.15f, 0.15f, 0.15f, 1.0f); list.Position = new Vector2(0.5f, 0); list.Scale = new Vector2(0.25f, 0.5f); string[] testStrings = new string[] { "Hello", "A Carton of Cigarettes", "Oh boy", "I hope this works", "25 or 6 to 4", "Rawr", "Christ", "El Captain", "John Wayne", "Walter White", "Stanford Cow", "Dr. Evil", "Tom Hanks", "Lindsey Lohan", "Raptor Jesus", "Timothy Leary", "Bauldur", "Frank Lloyd Wright", "Pink Floyd", "The Beatles", "JoCo", "Is this twenty yet??", }; list.Items.AddRange(testStrings); list.SetColor(new Vector4(0.15f, 0.15f, 0.15f, 1.0f)); //this.controls.Add(list); this.controls.Add(crosshair); this.controls.Add(journalStatus); this.controls.Add(compass); this.controls.Add(interactStatus); this.controls.Add(interactButton); this.controls.Add(scoreLabel); }
public AirplaneNode(Scene scene) { this.scene = scene; }
public BedNode(Scene scene) { this.scene = scene; }
public PowerPlant(Scene scene) { Model powerPlant = new Model("PowerPlant"); Model powerPlantFence = new Model("PowerPlantFence"); InteractObject switchA = new InteractObject(new SwitchNode(this, 0x1), "PowerPlantSwitchA"); InteractObject switchB = new InteractObject(new SwitchNode(this, 0x2), "PowerPlantSwitchB"); InteractObject switchC = new InteractObject(new SwitchNode(this, 0x4), "PowerPlantSwitchC"); InteractObject switchD = new InteractObject(new SwitchNode(this, 0x8), "PowerPlantSwitchD"); (scene.MainTerrain as TerrainVoxel).GetLandmarkTransform(MapLandmark.PowerPlant, powerPlant.Transformation, powerPlantFence.GetMesh().GetBounds()); //powerPlant.Transformation.SetPosition(powerPlant.Transformation.GetPosition()-Vector3.Up*94); Vector3 pos = powerPlant.Transformation.GetPosition(); Vector3 rot = powerPlant.Transformation.GetRotation(); powerPlantTransform = powerPlant.Transformation; (switchA.GetInteractNode() as SwitchNode).SetInteractObject(switchA); (switchB.GetInteractNode() as SwitchNode).SetInteractObject(switchB); (switchC.GetInteractNode() as SwitchNode).SetInteractObject(switchC); (switchD.GetInteractNode() as SwitchNode).SetInteractObject(switchD); powerPlantFence.Transformation = powerPlant.Transformation; SafeTrigger campTrigger = new SafeTrigger(); campTrigger.Transformation.SetPosition(powerPlantTransform.GetPosition()); campTrigger.Transformation.SetScale(Vector3.One * 30); scene.AddEntity("SafeTrigger", campTrigger); switchA.Transformation.SetPosition(pos); switchA.Transformation.SetRotation(rot); switchB.Transformation.SetPosition(pos); switchB.Transformation.SetRotation(rot); switchC.Transformation.SetPosition(pos); switchC.Transformation.SetRotation(rot); switchD.Transformation.SetPosition(pos); switchD.Transformation.SetRotation(rot); AnimationNode[] nodes = powerPlantFence.GetMesh().GetNodes(); Matrix worldMatrix = powerPlantFence.Transformation.GetTransform(); //Vector3 meshCenter = 0.5f * (gasStation.GetMesh().GetBounds().Max + gasStation.GetMesh().GetBounds().Min); for (int i = 0; i < nodes.Length; i++) { if (nodes[i].Name == "DoorHinge") { InteractObject door = new InteractObject(null, "PowerPlantDoor", true); Vector3 doorPos = Vector3.Transform(nodes[i].Translation, worldMatrix); door.Transformation.SetPosition(doorPos); door.Transformation.SetRotation(powerPlantFence.Transformation.GetRotation()); door.SetInteractNode(new PowerPlantDoorNode(door, new Vector3(0, MathHelper.PiOver2, 0), Vector3.Zero)); scene.AddEntity("PowerPlantDoor", door); } } //switchA.interactNode.OnInteract(); //switchD.interactNode.OnInteract(); scene.AddEntity("PowerPlant", powerPlant); scene.AddEntity("PowerPlantFence", powerPlantFence); scene.AddEntity("SwitchA", switchA); scene.AddEntity("SwitchB", switchB); scene.AddEntity("SwitchC", switchC); scene.AddEntity("SwitchD", switchD); List<int> potentialPuzzles = new List<int>(); for (int i = 0; i < (1 << 7); i++) { if (IsValidPuzzle(i)) { potentialPuzzles.Add(i); } } Puzzle = potentialPuzzles[RandomHelper.RandomGen.Next(potentialPuzzles.Count)]; int randInput = RandomHelper.RandomGen.Next(16); while (AttemptPuzzle(Puzzle, randInput)) randInput = RandomHelper.RandomGen.Next(16); IsEnabled = false; if ((randInput & 0x01) > 0) switchA.GetInteractNode().OnInteract(); if ((randInput & 0x02) > 0) switchB.GetInteractNode().OnInteract(); if ((randInput & 0x04) > 0) switchC.GetInteractNode().OnInteract(); if ((randInput & 0x08) > 0) switchD.GetInteractNode().OnInteract(); IsEnabled = true; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { new GFX(this.GraphicsDevice); new InputManager(); new ResourceManager(); ResourceManager.Inst.LoadResources(); GFX.Inst.GetGUI().DefaultFont = Content.Load<SpriteFont>("SimpleFont"); mainScene = new Scene(); mainScene.Initialize(); using (FileStream fs = new FileStream("Graphics.txt", FileMode.Create)) { using (StreamWriter wr = new StreamWriter(fs)) { PrintPresentationParameters(wr, GFX.Device.PresentationParameters); PrintRenderState(wr, GFX.Device.RenderState); PrintDeviceCapabilities(wr, GFX.Device.GraphicsDeviceCapabilities); } } }
public virtual void OnAdd(Scene scene) { this.scene = scene; }
public override void OnAdd(Scene scene) { base.OnAdd(scene); dinoDatablocks = ResourceManager.Inst.GetDinosaurDatablocks(); }
public PlayerScreen() : base() { inst = this; compass = new UICompass(); compass.Scale = new Vector2(0.35f, 0.05f); compass.Position = new Vector2(0, -0.85f); crosshair = new UIButton(ResourceManager.Inst.GetTexture("UI/Game/crossHair.dds"), Vector4.One, string.Empty); crosshair.Position = Vector2.Zero; crosshair.Scale = Vector2.One * 0.035f; journalStatus = new UIButton(null, Vector4.One, "Journal Updated!"); journalStatus.Position = new Vector2(0, 0.15f);// new Vector2(-0.7f, 0.85f); journalStatus.SetVisible(false); interactStatus = new UIButton(null, Vector4.One, "Examine Object"); interactStatus.Position = new Vector2(-0.7f, -0.85f); interactStatus.SetVisible(false); interactButton = new UIButton(ResourceManager.Inst.GetTexture("UI/Game/interact.dds"), Vector4.One, string.Empty); interactButton.Position = Vector2.Zero; interactButton.Scale = Vector2.One * 0.035f * 1.15f; interactButton.SetVisible(false); blackFade = new UIButton(null, Vector4.Zero, string.Empty); blackFade.Position = Vector2.Zero; blackFade.Scale = Vector2.One; blackFade.SetVisible(false); creditsLabel = new UIButton(null, Vector4.One, "Created by Matt Vitelli - Summer 2012"); creditsLabel.Position = Vector2.Zero; creditsLabel.Scale = Vector2.One; creditsLabel.SetVisible(false); list = new UIList(); list.ItemColor = new Vector4(0.15f, 0.15f, 0.15f, 1.0f); list.Position = new Vector2(0.5f, 0); list.Scale = new Vector2(0.25f, 0.5f); string[] testStrings = new string[] { "Hello", "A Carton of Cigarettes", "Oh boy", "I hope this works", "25 or 6 to 4", "Rawr", "Christ", "El Captain", "John Wayne", "Walter White", "Stanford Cow", "Dr. Evil", "Tom Hanks", "Lindsey Lohan", "Raptor Jesus", "Timothy Leary", "Bauldur", "Frank Lloyd Wright", "Pink Floyd", "The Beatles", "JoCo", "Is this twenty yet??", }; list.Items.AddRange(testStrings); list.SetColor(new Vector4(0.15f, 0.15f, 0.15f, 1.0f)); //this.controls.Add(list); healthBarTexture = (Texture2D)ResourceManager.Inst.GetTexture("UI/Game/healthBar.dds").GetTexture(); healthBarTexture2 = (Texture2D)ResourceManager.Inst.GetTexture("UI/Game/healthBar2.dds").GetTexture(); this.controls.Add(crosshair); this.controls.Add(journalStatus); this.controls.Add(compass); this.controls.Add(interactStatus); this.controls.Add(interactButton); this.controls.Add(blackFade); this.controls.Add(creditsLabel); this.scene = new Scene(); compass.AddCustomMarker(scene.FindEntity("Tent").Transformation, ResourceManager.Inst.GetTexture("UI/Game/Home.dds")); bgSound = new Sound2D("Crickets", true, false); bgSound.Paused = false; }
public WeaponBoxNode(Scene scene) { this.scene = scene; }
public void SetRenderAlways(bool renderAlways, Scene scene) { this.renderAlways = renderAlways; this.scene = scene; }
public SoundMaster(Scene scene) { this.scene = scene; }