protected override void Start() { fpsCamera = CameraManager.AddCamera("Robot POV " + ID.ToString(), parent: transform); fpsCamera.transform.localPosition = new Vector3(0f, 0.1f, 0.07f); fpsCamera.gameObject.AddComponent <RobotCameraScanning>(); thirdPersonCamera = CameraManager.AddCamera("Robot " + ID.ToString(), parent: transform, enableAudioListener: true, position: new Vector3(0, 2, 0), rotation: Quaternion.Euler(90, 0, 0)); GameObject light = transform.GetComponentInChildren <Light>().gameObject; light.SetParent(fpsCamera.transform); light.SetActive(false); flashlight = light; animator = new RobotFreeAnim(gameObject); fpsController = new FpsController(GetComponent <CharacterController>(), gameObject); EventManager.Subscribe <OnCodeEditorSaved, UpdateScriptEventArgs>(OnCodeSaved); OnFixedUpdate += RobotSphereUpdate; health = 100.0f; base.Start(); }
private void nxtbtn_Click(object sender, EventArgs e) { //foreach (PictureBox p in pblist) //{ // paintcamera(p.Location, p.Image, pblist.IndexOf(p)+1); //} //string path = System.IO.Directory.GetCurrentDirectory() + "\\final.jpg"; //Image img = new Bitmap(path); //pictureBox1.Image = img; // CameraManager cm = CameraManager.Instance; MessageBox.Show("Number of cameras : " + g1.numberofcameras()); for (int i = 0; i < g1.numberofcameras(); i++) { //var message = string.Join(Environment.NewLine, g1.getneighbour(i)); //MessageBox.Show(message); cm.AddCamera(g1.getName(i), g1.getip(i), g1.getRotation(i), g1.getUserName(i), g1.getPwd(i), g1.getReg(i), g1.getIden(i), g1.getTrack(i), pointList[i], g1.getOD(i)); cm.addNeighbours(g1.getName(i), g1.getneighbour(i), g1.getodNeighbour(i)); } // }
private IEnumerator Start() { guiCamera = CameraManager.AddCamera("GUI Camera", enableAudioListener: true); while (!ViewModel.Initialized) { yield return(null); } StartupMenuViewModel startupMenuViewModel = UIManager.Create <StartupMenuViewModel>(); BackgroundViewModel backgroundViewModel = UIManager.Create <BackgroundViewModel>(); startupMenuViewModel.IsActive = true; backgroundViewModel.IsActive = true; startupMenuViewModel.ZIndex = 1; backgroundViewModel.ZIndex = 0; EventManager.Subscribe <OnSinglePlayerButtonClicked>((o, e) => { Instantiate(Singelplayer); CurrentMode = Mode.Single; }); EventManager.Subscribe <OnMultiPlayersButtonClicked>((o, e) => { Instantiate(Multiplayers); CurrentMode = Mode.Multi; }); }
public void AddScriptByName(string scriptName) { Debug.Log("Adding script: " + scriptName); if (cars.Count == startPositions.Length) { Debug.Log("Too many cars added. (Count is " + cars.Count + ", max is " + startPositions.Length + ")"); return; } GameObject newCar = Instantiate(original) as GameObject; newCar.SetActive(true); cameraManager.AddCamera(newCar.GetComponentInChildren <Camera>()); newCar.transform.position = startPositions[cars.Count].position; newCar.transform.rotation = startPositions[cars.Count].rotation; SetCarColour(newCar); cars.Add(newCar); newCar.transform.FindChild("OurCar").SendMessage("SetCar", cars.Count - 1); // Do not remove this line! The hud will be sad otherwise. newCar.transform.FindChild("OurCar").SendMessage("SetScriptName", scriptName); newCar.SetActive(false); }
/// <summary> /// Load and calculate all the necessary content of the game. /// </summary> public override void Load() { base.Load(); // Set the camera CameraManager.AddCamera(CameraManager.DefaultCamera, new TargetCamera(new Vector3(0, 0, 70), new Vector3(0, 0, 0))); CameraManager.SetActiveCamera(CameraManager.DefaultCamera); }
void OnTriggerEnter(Collider other) { // If the player enters if (other.CompareTag("Player")) { // Set the camera to the controller m_camNum = m_camController.AddCamera(m_camera); // Switch to the new camera m_camController.SwitchToCamera(m_camNum); } }
void Start() { if (planetTransform == null) { planetTransform = GameObject.Find("Planet(Clone)").transform; } if (planetTransform == null) { Debug.Log("Error! missile cannot exist without planet!"); return; } if (transform.parent != planetTransform) { transform.SetParent(planetTransform);//Set the planet transform to be the parent of the missile } missileCamera = this.gameObject.GetComponentInChildren <Camera>(); missileCamera.enabled = false; CameraManager cameraManager = GameObject.Find("GameController").GetComponent <CameraManager>(); if (cameraManager != null) { cameraManager.AddCamera(missileCamera); } }
/// <summary> /// Load and calculate all the necessary content of the game. /// </summary> public override void Load() { base.Load(); // Set the camera CameraManager.AddCamera(CameraManager.DefaultCamera, new TargetCamera(new Vector3(0, 0, 70), new Vector3(0, 0, 0))); CameraManager.SetActiveCamera(CameraManager.DefaultCamera); // Create the post processing elements renderCapture = new RenderCapture(); postProcessor = new GaussianBlur(10);//2f); // Load all needed textures TextureManager.AddTexture(backgroundTexture, new GameTexture("Content/Textures/MenuBackground", true)); TextureManager.AddTexture("DeadBackground", new GameTexture("Content/Textures/DeadBackground", true)); TextureManager.AddTexture("SeparationBar", new GameTexture("Content/Textures/SeparationBar", true)); TextureManager.AddTexture("SelectedMenuEntry", new GameTexture("Content/Textures/SelectedMenuEntry", true)); TextureManager.AddTexture("DummyTexture15T", new GameTexture("Content/Textures/DummyTexture15T", true)); TextureManager.AddTexture("DummyTexture", new GameTexture("Content/Textures/DummyTexture", true)); TextureManager.AddTexture("BarTexture", new GameTexture("Content/Textures/BarTexture", true)); TextureManager.AddTexture("DialogBackground", new GameTexture("Content/Textures/DialogBackground", true)); TextureManager.AddTexture("EasyDifficult", new GameTexture("Content/Textures/EasyDifficult", true)); TextureManager.AddTexture("NormalDifficult", new GameTexture("Content/Textures/NormalDifficult", true)); TextureManager.AddTexture("HardDifficult", new GameTexture("Content/Textures/HardDifficult", true)); TextureManager.AddTexture("LoadingBackground", new GameTexture("Content/Textures/LoadingBackground", true)); // Load all needed sounds SoundManager.AddSound("Menu", new GameSound("Content/Sounds/Menu", true)); SoundManager.GetSound("Menu").Volume = GameSettings.DefaultInstance.MusicVolume; SoundManager.GetSound("Menu").Play(true, true); SoundManager.AddSound("MenuSelect", new GameSound("Content/Sounds/MenuSelect", true)); SoundManager.GetSound("MenuSelect").Volume = GameSettings.DefaultInstance.SoundVolume; SoundManager.AddSound("MenuAccept", new GameSound("Content/Sounds/MenuAccept", true)); SoundManager.GetSound("MenuAccept").Volume = GameSettings.DefaultInstance.SoundVolume; // Load all needed models ModelManager.AddModel(spacecraftModel, new GameModel("Content/Models/Spacecraft", true)); ModelManager.AddModel("AnimatedMonster", new GameModel("Content/Models/AnimatedMonster", true)); _model = new DrawableModel((GameModel)ModelManager.GetModel(spacecraftModel), new Vector3(-10, 20, 0), new Vector3(-45, 120, 0), new Vector3(1.25f, 1.25f, 1.25f), 0); // Fix the animation elements _animationRing1 = new ObjectAnimation(Vector3.Zero, Vector3.Zero, _model.Rotation, _model.Rotation + new Vector3(0, MathHelper.TwoPi, 0), TimeSpan.FromSeconds(1f), true); _animationRing2 = new ObjectAnimation(Vector3.Zero, Vector3.Zero, _model.Rotation + new Vector3(0, MathHelper.Pi, 0), _model.Rotation + new Vector3(0, MathHelper.TwoPi + MathHelper.Pi, 0), TimeSpan.FromSeconds(1f), true); _individualTransformations.Add("polySurface26", Matrix.CreateScale(_animationRing1.Scale) * Matrix.CreateRotationX(_animationRing1.Rotation.X) * Matrix.CreateRotationY(_animationRing1.Rotation.Y) * Matrix.CreateRotationZ(_animationRing1.Rotation.Z) * Matrix.CreateTranslation(_animationRing1.Position)); _individualTransformations.Add("polySurface27", Matrix.CreateScale(_animationRing2.Scale) * Matrix.CreateRotationX(_animationRing2.Rotation.X) * Matrix.CreateRotationY(_animationRing2.Rotation.Y) * Matrix.CreateRotationZ(_animationRing2.Rotation.Z) * Matrix.CreateTranslation(_animationRing2.Position)); }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); contentLibrary = new ContentLibrary(); contentLibrary.Load(GraphicsDevice, Content); basicEffect = new BasicEffect(GraphicsDevice); _space = new Space(); _space.ForceUpdater.Gravity = MathConverter.Convert(new Vector3(0, -9.81f, 0)); font = Content.Load <SpriteFont>("Arial"); _fpsCounter = new FPSCounter(this, font); _fpsCounter.LoadContent(); camManager = new CameraManager(); camManager.AddCamera("player", cam); camManager.MainCameraName = "player"; simplexDensityFunction = new SimplexDensityFunction(0.01f, 0.1f); EngineConfiguration config = new EngineConfiguration(); config.ChunkWidth = 16; config.ChunkHeight = 16; config.ChunkLength = 16; config.CPULightingEnabled = true; config.RenderDistance = 5; int worldChunkHeight = 8; SphereDensityFunction sdf = new SphereDensityFunction(new Vector3(8, 8, 8), 7.5f); SineWaveDensityFunction swdf = new SineWaveDensityFunction(5, 10, 0.25f); DualContourIslandChunkGenerator icg = new DualContourIslandChunkGenerator(worldChunkHeight * config.ChunkHeight, new SimplexNoiseGenerator(Environment.TickCount)); DualContourFlatLandGenerator flg = new DualContourFlatLandGenerator(); DensityChunkGenerator dcg = new DensityChunkGenerator(swdf); DebuggerGenerator dg = new DebuggerGenerator(); IChunkGenerator generator; ITerrainGradientFunction grad; generator = icg; grad = icg; _world = new World(config, camManager); _chunkManager = new StaticThreadedChunkManager(config, _world, 5, worldChunkHeight, 5); _chunkManager.ChunkSystem = new DualContourColoredChunkSystem(GraphicsDevice, contentLibrary, _chunkManager, camManager, _world, grad, 0.0f); _chunkManager.ChunkSystem.Builder.MeshBuilt += new MeshBuildEventHandler(BuildPhysicsMesh); _chunkManager.ChunkGenerator = generator; _chunkManager.LightManager = new FloodfillLightManager(_chunkManager, config, worldChunkHeight); _world.ChunkManager = _chunkManager; _chunkManager.GenerateChunks(); _chunkManager.BuildAllChunks(); }
public void CreateAlternateTimeline(Transform spawnLocation) { GameObject newPlayer = Factory.PlayerFactory.CreateAlternatePlayer(spawnLocation); newPlayer.GetComponent <CharacterBehaviour>().activeCam = m_CameraManager.AddCamera(newPlayer); }
void Start() { m_cameraManager = FindObjectOfType<CameraManager>(); m_cameraNum = m_cameraManager.AddCamera(m_deathCamera); }
public void AddCamera(String name, Camera camera) { _cameraManager.AddCamera(name, camera); }
/// <summary> /// Load graphics content for the game. /// </summary> public override void LoadContent() { if (content == null) { content = new ContentManager(ScreenManager.Game.Services, "Content"); } gameFont = content.Load <SpriteFont>("gamefont"); // A real game would probably have more content than this sample, so // it would take longer to load. We simulate that by delaying for a // while, giving you a chance to admire the beautiful loading screen. #region Locals spriteBatch = new SpriteBatch(ScreenManager.GraphicsDevice); otherTexture = ScreenManager.Game.Content.Load <Texture2D>("vein256"); #endregion Locals #region Camera Manager cameraManager = new CameraManager(ScreenManager.Game); Costam.CameraManager = cameraManager; DebugCamera camera = new Core.DebugCamera(ScreenManager.Game, new Vector3(-15, 0, 0), Vector3.Zero, Vector3.Up); ChaseCamera chaseCamera = new ChaseCamera(ScreenManager.Game); cameraManager.AddCamera("DebugCamera", camera); cameraManager.AddCamera("ChaseCamera", chaseCamera); #endregion CameraManager #region Triggers triggerManager = new TriggerManager(ScreenManager.Game); Costam.TriggerManager = triggerManager; #endregion Triggers #region Tunnel Manager tunnelManager = new TunnelManager(ScreenManager.Game); Costam.TunnelManager = tunnelManager; #endregion TunnelManager #region Memory Managment objectsProvider = new SimpleMemoryPool(); Costam.MemoryPoolObjectProvider = objectsProvider; #endregion Memory Managment #region Player playerManager = new PlayerManager(ScreenManager.Game); Costam.PlayerManager = playerManager; chaseCamera.ChasedObject = Costam.PlayerManager.players.ElementAt(0).Value; #endregion PLayer #region HUD hud = new Hud(ScreenManager.Game, spriteBatch); Costam.HUD = hud; //ScreenManager.Game.Components.Add(hud); SpriteFont consoleFont = ScreenManager.Game.Content.Load <SpriteFont>("HudFont"); DebugTextWindow = new DebugConsole(new Rectangle(10, 10, 100, 50), consoleFont); hud.AddComponent(DebugDrawWindowName, DebugTextWindow); Vector2 windowDimensions = new Vector2(ScreenManager.Game.GraphicsDevice.Viewport.Width, ScreenManager.Game.GraphicsDevice.Viewport.Height); FPSCounter fpsCounter = new FPSCounter(new Rectangle((int)windowDimensions.X - 60, 5, 30, 20), consoleFont); hud.AddComponent("FPS", fpsCounter); if (playerManager.players.Count < 2) { PlayerHUD player1HUD = new PlayerHUD(new Rectangle((int)windowDimensions.X / 2, 0, 30, 20), consoleFont, playerManager.players.ElementAt(0).Value); hud.AddComponent("player1HUD", player1HUD); } else { PlayerHUD player1HUD = new PlayerHUD(new Rectangle(((int)windowDimensions.X / 2) - 70, 0, 30, 20), consoleFont, playerManager.players.ElementAt(0).Value); hud.AddComponent("player1HUD", player1HUD); PlayerHUD player2HUD = new PlayerHUD(new Rectangle((int)windowDimensions.X / 2, 0, 30, 20), consoleFont, playerManager.players.ElementAt(1).Value); hud.AddComponent("player2HUD", player2HUD); } #endregion HUD #region Object Manager objectManager = new ObjectManager(Costam.Game); Costam.ObjectManager = objectManager; #endregion Object Manager #region Colision Manager collisionManager = new CollisionManager(Costam.Game); Costam.ColisionManager = collisionManager; #endregion Colision Manager #region Debug debugDraw = new DebugDraw(); Costam.DebugDraw = debugDraw; Costam.Random = new Random((int)System.DateTime.Now.Ticks); #endregion Debug AfterLoadContent(); // once the load has finished, we use ResetElapsedTime to tell the game's // timing mechanism that we have just finished a very long frame, and that // it should not try to catch up. ScreenManager.Game.ResetElapsedTime(); }