コード例 #1
0
 private void Awake()
 {
     m_MovementController = GetComponent <CharacterMovementController>();
     m_Input = GetComponent <CharacterInputBase>();
     m_GraphicsController = GetComponent <GraphicsController>();
     m_DefeatableBase     = GetComponent <DefeatableBase>();
 }
コード例 #2
0
        /*
         * Textures found at:
         * http://www.solarsystemscope.com/nexus/textures/planet_textures/
         */
        public RenderWindow(int width, int height, OpenTK.Graphics.GraphicsMode mode, string title) : base(width, height, mode, title)
        {
            physController  = new PhysicsController();
            camController   = new CameraController(new double[] { 0, 0.0f, -10000000 });//new double[] { -1000000.0f, 0.0f, -1000000.0f });
            graphController = new GraphicsController();
            graphController.ReadObjFile("sphere.obj");
            graphController.ReadSkyObjFile("skybox.obj");

            int[] newTextureIds = new int[8];
            GL.GenTextures(8, newTextureIds);
            newTextureIds[0] = graphController.LoadTexture("Textures/texture_sun.jpg");
            newTextureIds[1] = graphController.LoadTexture("Textures/texture_earth_clouds.jpg");
            newTextureIds[2] = graphController.LoadTexture("Textures/texture_mercury.jpg");
            newTextureIds[3] = graphController.LoadTexture("Textures/texture_venus_surface.jpg");
            newTextureIds[4] = graphController.LoadTexture("Textures/texture_mars.jpg");
            newTextureIds[5] = graphController.LoadTexture("Textures/texture_jupiter.jpg");
            newTextureIds[6] = graphController.LoadTexture("Textures/texture_saturn.jpg");
            newTextureIds[7] = graphController.LoadTexture("Textures/texture_moon.jpg");

            skyboxTextureId = graphController.LoadTexture("Textures/texture_skybox.jpg");
            textureIds      = newTextureIds;

            // Skybox
            double[] skyboxPos = new double[] { (float)-Math.Pow(10, 11) / 2, (float)-Math.Pow(10, 11) / 2, (float)-Math.Pow(10, 11) / 2 };
            skybox = new SimObject(skyboxPos, new PhysicsObject(), graphController.CreateSkyboxObj(1));
        }
コード例 #3
0
    void Start()
    {
        inputController    = Utilities.GetChildScript <InputController>(this.gameObject, "InputControllerGO");
        graphicsController = Utilities.GetChildScript <GraphicsController>(this.gameObject, "GraphicsControllerGO");
        gameController     = Utilities.GetChildScript <GameController>(this.gameObject, "GameControllerGO");

        if (inputController == null || graphicsController == null || gameController == null)
        {
            Debug.LogError("Controller not found!");
        }

        CreateGame(2);
        graphicsController.State = GameState.GAME;
    }
コード例 #4
0
ファイル: ChangeGame.cs プロジェクト: splerp/change
        protected override void Initialize()
        {
            inputController    = new InputController();
            soundController    = new SoundController();
            graphicsController = new GraphicsController(this, inputController, GraphicsDevice);
            gameController     = new GameController(this, graphicsController, inputController);

            base.Initialize();

            // Set initial state to the main menu.
            gameController.SetState(GameState.Title);

            // Start the now-loaded song.
            soundController.StartSong();
        }
コード例 #5
0
ファイル: Traffic.cs プロジェクト: KamilLepek/Traffic
        private static void Main(string[] args)
        {
            int verticalLines           = 4;
            int horizontalLines         = 4;
            int desiredNumberOfVehicles = 300;

            var simulationController =
                new SimulationController(horizontalLines, verticalLines, desiredNumberOfVehicles);

            simulationController.InitSimulation();

            var graphicsController = new GraphicsController(simulationController.World,
                                                            simulationController.PerformSimulationTick);

            graphicsController.Run(Constants.TicksPerSecond);
        }
コード例 #6
0
 public void Setup()
 {
     Company = new Company
     {
         Id          = "TaxiDiamond",
         CompanyName = "Taxi Diamond",
     };
     ServiceMock = new Mock <ICompanyService>();
     ServiceMock.Setup(x => x.GetCompany()).Returns(Company);
     GraphicsManagerMock = new Mock <IFileManager>();
     Graphics            = GraphicsManagerMock.Object;
     Sut = new GraphicsController
     {
         Service  = ServiceMock.Object,
         Graphics = Graphics
     };
 }
コード例 #7
0
ファイル: MainWindow.xaml.cs プロジェクト: KamilLepek/Traffic
        private void StartButton_Click(object sender, RoutedEventArgs e)
        {
            int verticalLines, horizontalLines, desiredNumberOfVehicles;

            try
            {
                verticalLines = Convert.ToInt32(this.VerticalLinesAmountTextBox.Text);
                if (verticalLines > Constants.MaxAmountOfLines)
                {
                    MessageBox.Show("Max amount of vertical lines is: " + Constants.MaxAmountOfLines);
                    this.VerticalLinesAmountTextBox.Text = Constants.MaxAmountOfLines.ToString();
                    return;
                }
                horizontalLines = Convert.ToInt32(this.HorizontalLinesAmountTextBox.Text);
                if (horizontalLines > Constants.MaxAmountOfLines)
                {
                    MessageBox.Show("Max amount of horizontal lines is: " + Constants.MaxAmountOfLines);
                    this.HorizontalLinesAmountTextBox.Text = Constants.MaxAmountOfLines.ToString();
                    return;
                }
                desiredNumberOfVehicles = Convert.ToInt32(this.CarAmountTextBox.Text);
                if (desiredNumberOfVehicles > horizontalLines * verticalLines * Constants.CarAmountNormalizationConstant)
                {
                    MessageBox.Show("For given amount of vertical and horizontal lines max amount of cars is: " +
                                    horizontalLines * verticalLines * Constants.CarAmountNormalizationConstant);
                    this.CarAmountTextBox.Text = (horizontalLines * verticalLines * Constants.CarAmountNormalizationConstant).ToString();
                    return;
                }
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message);
                this.Clear();
                return;
            }
            this.Hide();
            var simulationController = new SimulationController(horizontalLines, verticalLines, desiredNumberOfVehicles);

            simulationController.InitSimulation();
            var graphicsController = new GraphicsController(simulationController.World, simulationController.PerformSimulationTick);

            graphicsController.Run(Constants.TicksPerSecond);
            this.Show();
        }
コード例 #8
0
        /*
         * Textures found at:
         * http://www.solarsystemscope.com/nexus/textures/planet_textures/
         */
        public RenderWindow(int width, int height, OpenTK.Graphics.GraphicsMode mode, string title)
            : base(width, height, mode, title)
        {
            physController  = new PhysicsController();
            camController   = new CameraController(new double[] { 0, 0.0f, -5000000 });
            graphController = new GraphicsController();
            graphController.ReadObjFile("sphere.obj");

            int[] newTextureIds = new int[11];
            newTextureIds[0] = graphController.LoadTexture("Textures/texture_sun.jpg");
            newTextureIds[1] = graphController.LoadTexture("Textures/texture_mercury.jpg");
            newTextureIds[2] = graphController.LoadTexture("Textures/texture_venus_atmosphere.jpg");
            newTextureIds[3] = graphController.LoadTexture("Textures/texture_earth_surface.jpg");
            newTextureIds[4] = graphController.LoadTexture("Textures/texture_mars.jpg");
            newTextureIds[5] = graphController.LoadTexture("Textures/texture_jupiter.jpg");
            newTextureIds[6] = graphController.LoadTexture("Textures/texture_saturn.jpg");
            newTextureIds[7] = graphController.LoadTexture("Textures/texture_uranus.jpg");
            newTextureIds[8] = graphController.LoadTexture("Textures/texture_neptune.jpg");
            newTextureIds[9] = graphController.LoadTexture("Textures/texture_moon.jpg");

            newTextureIds[10] = graphController.LoadTexture("Textures/texture_skybox.jpg");
            textureIds        = newTextureIds;
        }
コード例 #9
0
        private Int32 DrawRow(Vector2 position, String rowName, String picturePath)
        {
            Int32 rowHeight   = SessionStatisticsCore.SettingsInstance.DropBoardRowHeight;
            Int32 rowWidth    = SessionStatisticsCore.SettingsInstance.DropBoardRowWidth;
            float neededWidth = SessionStatisticsCore.SettingsInstance.DropBoardNeededWidth;

            String areaDrops    = Session.Instance.AreaStatistic.Currency[rowName].ToString();
            String sessionDrops = Session.Instance.SessionStatistic.Currency[rowName].ToString();

            //Currency-Picture
            String     picPath = String.Format("{0}\\{1}", SessionStatisticsCore.WorkingDirectory, String.Format("{0}.png", picturePath));
            RectangleF picRect = new RectangleF(position.X, position.Y, rowHeight, rowHeight);

            //Area-Value
            Size2      areaValueSize     = GraphicsController.MeasureText(areaDrops, 18);
            Vector2    areaValuePosition = new Vector2(picRect.Right, (picRect.Center.Y - areaValueSize.Height / 2));
            RectangleF areaValueFrame    = new RectangleF(picRect.Right, position.Y, rowWidth, rowHeight);

            areaValuePosition.X += 5;

            //Session-Value
            Size2   sessionValueSize     = GraphicsController.MeasureText(sessionDrops, 18);
            Vector2 sessionValuePosition = new Vector2(areaValueFrame.Right, (picRect.Center.Y - sessionValueSize.Height / 2));

            sessionValuePosition.X += 5;
            RectangleF sessionValueFrame = new RectangleF(areaValueFrame.Right, position.Y, rowWidth, rowHeight);

            //Draw
            GraphicsController.DrawBox(new RectangleF(position.X, position.Y, neededWidth, rowHeight), Color.Black);
            GraphicsController.DrawPluginImage(picPath, picRect);
            GraphicsController.DrawText(areaDrops, 18, areaValuePosition);
            GraphicsController.DrawText(sessionDrops, 18, sessionValuePosition);
            GraphicsController.DrawFrame(picRect, 1.0f, Color.Wheat);
            GraphicsController.DrawFrame(areaValueFrame, 1.0f, Color.Wheat);
            GraphicsController.DrawFrame(sessionValueFrame, 1.0f, Color.Wheat);
            return(rowHeight);
        }
コード例 #10
0
        static void Main(string[] args)
        {
            GraphicsController graphCon         = new GraphicsController();
            List <SimObject>   simulatedObjects = new List <SimObject>();
            List <Matrix4>     transList        = new List <Matrix4>();
            PhysicsController  physics          = new PhysicsController();

            /* HANDLE GRAPHICS */
            graphCon.ReadObjFile("sphere.obj");
            graphCon.ReadSkyObjFile("skybox.obj");

            // The Sun
            GraphicsObject sunGraphics = graphCon.CreateGraphicsObj(0);

            // Earth
            GraphicsObject earthGraphics = graphCon.CreateGraphicsObj(0);

            // Mercury
            GraphicsObject mercuryGraphics = graphCon.CreateGraphicsObj(0);

            // Venus
            GraphicsObject venusGraphics = graphCon.CreateGraphicsObj(0);

            // Mars
            GraphicsObject marsGraphics = graphCon.CreateGraphicsObj(0);

            // Jupiter
            GraphicsObject jupiterGraphics = graphCon.CreateGraphicsObj(0);

            // Saturn
            GraphicsObject saturnGraphics = graphCon.CreateGraphicsObj(0);

            /* GFX HANDLING DONE */


            /* HANDLE PHYSICS */
            PhysicsObject sunPhys = new PhysicsObject();

            sunPhys.Mass         = 1.98843 * Math.Pow(10, 30);
            sunPhys.Radius       = 6963420;
            sunPhys.Velocity     = new double[3];
            sunPhys.Acceleration = new double[3];

            PhysicsObject earthPhys = new PhysicsObject();

            earthPhys.Mass         = 5.97223 * Math.Pow(10, 24);
            earthPhys.Radius       = 637100;
            earthPhys.Velocity     = new double[] { 0, 0, 29.78 * 1000 };
            earthPhys.Acceleration = new double[3];

            PhysicsObject mercuryPhys = new PhysicsObject();

            mercuryPhys.Mass         = 3.3022 * Math.Pow(10, 23);
            mercuryPhys.Radius       = 243900.7;
            mercuryPhys.Velocity     = new double[] { 0, 0, 47.362 * 1000 };
            mercuryPhys.Acceleration = new double[3];

            PhysicsObject venusPhys = new PhysicsObject();

            venusPhys.Mass         = 4.8676 * Math.Pow(10, 24);
            venusPhys.Radius       = 605100.8;
            venusPhys.Velocity     = new double[] { 0, 0, 35.02 * 1000 };
            venusPhys.Acceleration = new double[3];

            PhysicsObject marsPhys = new PhysicsObject();

            marsPhys.Mass         = 6.4185 * Math.Pow(10, 23);
            marsPhys.Radius       = 338900.5;
            marsPhys.Velocity     = new double[] { 0, 0, 24.077 * 1000 };
            marsPhys.Acceleration = new double[3];

            PhysicsObject jupiterPhys = new PhysicsObject();

            jupiterPhys.Mass         = 1.8986 * Math.Pow(10, 27);
            jupiterPhys.Radius       = 699110;
            jupiterPhys.Velocity     = new double[] { 0, 0, 13.07 * 1000 };
            jupiterPhys.Acceleration = new double[3];

            PhysicsObject saturnPhys = new PhysicsObject();

            saturnPhys.Mass         = 5.6846 * Math.Pow(10, 26);
            saturnPhys.Radius       = 602680;
            saturnPhys.Velocity     = new double[] { 0, 0, 9.69 * 1000 };
            saturnPhys.Acceleration = new double[3];

            /* PHYSICS HANDLING DONE*/


            /* PEPARE SIMOBJECTS */

            SimObject sunSim = new SimObject(new double[] { 0, 0, 0 }, sunPhys, sunGraphics);

            sunSim.Scale = new double[] { sunPhys.Radius, sunPhys.Radius, sunPhys.Radius };

            SimObject earthSim = new SimObject(new double[] { 149598261.0, 0, 0 }, earthPhys, earthGraphics);

            earthSim.Scale = new double[] { earthPhys.Radius, earthPhys.Radius, earthPhys.Radius };

            SimObject mercurySim = new SimObject(new double[] { 57909050.0, 0, 0 }, mercuryPhys, mercuryGraphics);

            mercurySim.Scale = new double[] { mercuryPhys.Radius, mercuryPhys.Radius, mercuryPhys.Radius };

            SimObject venusSim = new SimObject(new double[] { 108208000.0, 0, 0 }, venusPhys, venusGraphics);

            venusSim.Scale = new double[] { venusPhys.Radius, venusPhys.Radius, venusPhys.Radius };

            SimObject marsSim = new SimObject(new double[] { 227939100.0, 0, 0 }, marsPhys, marsGraphics);

            marsSim.Scale = new double[] { marsPhys.Radius, marsPhys.Radius, marsPhys.Radius };

            SimObject jupiterSim = new SimObject(new double[] { 778547200.0, 0, 0 }, jupiterPhys, jupiterGraphics);

            jupiterSim.Scale = new double[] { jupiterPhys.Radius, jupiterPhys.Radius, jupiterPhys.Radius };

            SimObject saturnSim = new SimObject(new double[] { 1433449370.0, 0, 0 }, saturnPhys, saturnGraphics);

            saturnSim.Scale = new double[] { saturnPhys.Radius, saturnPhys.Radius, saturnPhys.Radius };

            /* SIMOBJECTS PREPARED */

            /* Setup SimObjList & GraphicsController */
            RenderWindow renderWindow = new RenderWindow(1024, 768, OpenTK.Graphics.GraphicsMode.Default, "Solar Simulation");

            renderWindow.AddDrawObj(sunSim);
            renderWindow.AddDrawObj(earthSim);

            renderWindow.AddDrawObj(mercurySim);
            renderWindow.AddDrawObj(venusSim);
            renderWindow.AddDrawObj(marsSim);
            renderWindow.AddDrawObj(jupiterSim);
            renderWindow.AddDrawObj(saturnSim);
            renderWindow.InitScene();
            renderWindow.Run();
        }
コード例 #11
0
 public SetIntersightGraphicsController()
 {
     ApiInstance = new GraphicsApi(Config);
     ModelObject = new GraphicsController();
     MethodName  = "UpdateGraphicsControllerWithHttpInfo";
 }
 /// <summary>
 /// Creates the graphics controller for the character.
 /// </summary>
 protected virtual void CreateGraphicsController()
 {
     graphicsControllerReference = gameObject.AddComponent <GraphicsController>();
 }