private void CreateSystems() { ISystem newSystem; //Render Systems newSystem = new SystemRender(cameraList, lightPosition, sceneManager.ClientRectangle); systemManager.AddRenderSystem(newSystem); //Update Systems newSystem = new SystemAudio(mainCamera); systemManager.AddUpdateSystem(newSystem); newSystem = new SystemAI(map, Maze.rows, Maze.columns, player); systemManager.AddUpdateSystem(newSystem); newSystem = new SystemSphereCollision(); systemManager.AddUpdateSystem(newSystem); newSystem = new SystemBoxCollision(); systemManager.AddUpdateSystem(newSystem); newSystem = new SystemAIMovement(sceneManager); systemManager.AddUpdateSystem(newSystem); newSystem = new SystemMovement(sceneManager); systemManager.AddUpdateSystem(newSystem); //Assigns entities to appropriate systems systemManager.AssignEntities(entityManager); }
/// <summary> /// Intilises all systems required for this scene and updates SystemManager /// </summary> private void CreateSystems() { // Intialises all systems needed in this scene and add them to SystemManager ISystem newSystem; // Creates the system to calculate the SkyBox newSystem = new SystemSkyBox(ref sceneManager.camera); systemManager.AddSystem(newSystem); // Creates an array of light point for use in SystemRenderer Vector3[] array = new Vector3[] { new Vector3(0.0f, 1.0f, 0.0f), new Vector3(17.0f, 1.0f, 15.0f), new Vector3(17.0f, 1.0f, -15.0f), new Vector3(-17.0f, 1.0f, 15.0f), new Vector3(-17.0f, 1.0f, -15.0f) }; // Creates the system to calculate all the rendering (including lighting) newSystem = new SystemRender(ref sceneManager.camera, array); systemManager.AddSystem(newSystem); // Creates the system to calculate all the collision (and trigger) events newSystem = new SystemCollider(ref entityManager, ref sceneManager.camera); systemManager.AddSystem(newSystem); // Creates the system to calculate all the AI paths and behaviours newSystem = new SystemAI(50, 50, entityManager.Entities().ToArray()); systemManager.AddSystem(newSystem); // Creates the system to update all the audio effects newSystem = new SystemAudio(); systemManager.AddSystem(newSystem); // Creates the system to calculate all the animation transformions newSystem = new SystemAnimator(); systemManager.AddSystem(newSystem); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="e">Provides a snapshot of timing values.</param> public override void Update(FrameEventArgs e) { // Checks if the player has collected all the coins needed to win the level if (CoinsCollected >= NumberOfCoins) { sceneManager.ChangeScene(3); return; } // Game timing related features float dt = (float)e.Time; if (PowerUpTimer > 0) { // Manages when the Power up sound effect plays and for how long and also updates playing position PowerUpTimer -= dt; SoundEffects[4].UpdateEmitterPosition(sceneManager.camera.Position); // This will only run once right after the power up is collected to prevent multiple sound effects playing if (!isPowerUpSound) { // Updates the sound effects settings SoundEffects[4].VolumeOfAudio = 0.4f; SoundEffects[4].LoopPlayAudio = true; SoundEffects[4].PlayAudio(); isPowerUpSound = true; } // If this passes then the power up period has finised and all returns to normal if (PowerUpTimer <= 0) { PowerUpTimer = 0.0f; isPowerUp = false; isPowerUpSound = false; // Make sure to clean up audio trail SoundEffects[4].Close(); } } // This is required for the AI (and physics) system to work as the AI require deltatime to work consitently SystemAI AI = (SystemAI)systemManager.FindSystem("SystemAI"); if (DebugGhosts) { AI.UpdateDeltaTime(0.0f); } else { AI.UpdateDeltaTime(dt); } // This is requried for consitent animation across systems SystemAnimator Animator = (SystemAnimator)systemManager.FindSystem("SystemAnimator"); Animator.UpdateDeltaTime(dt); // Updates the AI to follow the player when its position changes ManageGhostTargets(); // Checks for trigger collisions that need acting on such as item pickup or ghost collision ManageTriggerCollisions(); // Handles the player inputs to move the player ManageMovement(dt); }
private void CreateSystems() { SystemBase newSystem; systemManager.InitializeSystem(); newSystem = new SystemPlayerController(); systemManager.AddSystem(newSystem); newSystem = new SystemTimedDestroy(); systemManager.AddSystem(newSystem); newSystem = new SystemAI(); systemManager.AddSystem(newSystem); newSystem = new SystemFollow(); systemManager.AddSystem(newSystem); }
private void CreateSystems() { ISystem newSystem; newSystem = new SystemMinimap(minimap); systemManager.AddSystem(newSystem); newSystem = new SystemRender(); systemManager.AddSystem(newSystem); newSystem = new SystemLighting(); systemManager.AddSystem(newSystem); newSystem = new SystemInput(); systemManager.AddSystem(newSystem); newSystem = new SystemPhysics(); systemManager.AddSystem(newSystem); newSystem = new SystemAI(); systemManager.AddSystem(newSystem); newSystem = new SystemPickUp(); systemManager.AddSystem(newSystem); newSystem = new SystemAudio(); systemManager.AddSystem(newSystem); }
void Start() { SystemAI = SystemAI.Get(ID); FightSystem.Instance.AddCoreB(SystemAI.Core); FightSystem.Instance.DeckListB.Deck.AddRange(SystemAI.Deck); }