Beispiel #1
0
        public Scene( Renderer renderer )
        {
            this.renderer = renderer;

            camera = new Camera( renderer );

            crosshair = new Cursor( renderer, "crosshair", new Size( 50, 49 ) );

            arenaSize = new Size( config.GetSetting<int>( "ArenaWidth" ), config.GetSetting<int>( "ArenaHeight" ) );

            aimMode = config.GetSetting<string>( "AimMode" );
            cameraMode = config.GetSetting<string>( "CameraMode" );
            shadows = config.GetSetting<bool>( "Shadows" );

            if ( aimMode != "Relative" && aimMode != "Absolute" )
            {
                Log.Write( "Invalid value for setting 'AimMode'. Defaulting to AimMode = 'Absolute'." );
                aimMode = "Absolute";
            }

            if ( cameraMode != "Fixed" && cameraMode != "Floating" )
            {
                Log.Write( "Invalid value for setting 'CameraMode'. Defaulting to CameraMode = 'Floating'." );
                cameraMode = "Floating";
            }

            lavaTexCoordTiling = config.GetSetting<float>( "LavaTexCoordTiling" );

            arenaGround = new Surface( renderer, "arenaGround", arenaSize, 2.0f );
            lava = new Surface( renderer, "lava", new Size( renderer.FullscreenSize.Width, renderer.FullscreenSize.Height ),
                lavaTexCoordTiling );

            playerBot = new Robot( renderer, new PlayerRobotControl( crosshair ), this );
            cpuBot = new Robot( renderer, new CPURobotControl( this ), this );

            statsFont = new Gas.Graphics.Font( renderer, "Arial", 14 );
            statsFont.ShadowColor = Color.Black;

            playerBot.Position = new Vector2( 500.0f, 0.0f );
            cpuBot.Position = new Vector2( -500.0f, 0.0f );

            entityArbiter.AddEntity( playerBot );
            entityArbiter.AddEntity( cpuBot );

            PopulateArenaWithObstacles();
        }
Beispiel #2
0
 public void AttachToRobot( Robot robot )
 {
     this.robot = robot;
 }