示例#1
0
        /// <inheritdoc />
        public override void Initialize()
        {
            Game.Background = Color.CornflowerBlue;

            // Creates a Static Camera pointing to the center
            Camera = new StaticCamera(GraphicsDevice.Viewport.AspectRatio,
                                      Vector3.Forward * 100f + Vector3.Up * 100f,
                                      -Vector3.Normalize(Vector3.Forward + Vector3.Up),
                                      Vector3.Up);

            // Robot position and matrix initialization
            RobotPosition = Vector3.Zero;
            RobotWorld    = Matrix.CreateScale(0.3f);


            // Chair position and matrix initialization
            ChairAngle       = MathHelper.PiOver4;
            ChairScale       = Matrix.CreateScale(0.5f);
            ChairTranslation = Matrix.CreateTranslation(Vector3.UnitX * 50f);
            ChairWorld       = ChairScale * Matrix.CreateRotationY(ChairAngle) * ChairTranslation;

            // Tank position and matrix initialization
            TankPosition = -Vector3.UnitX * 10f + Vector3.UnitZ * 10f;
            TankWorld    = Matrix.CreateScale(3f) * Matrix.CreateTranslation(TankPosition);

            // Robot two position and matrix initialization
            var robotTwoPosition = Vector3.UnitX * -50f + Vector3.UnitZ * 10f;

            RobotTwoWorld    = Matrix.CreateScale(0.25f) * Matrix.CreateRotationY(MathHelper.PiOver4 + MathHelper.PiOver2) * Matrix.CreateTranslation(robotTwoPosition);
            RobotTwoCylinder = new BoundingCylinder(robotTwoPosition, 5f, 10f);

            base.Initialize();
        }
示例#2
0
 private void Start()
 {
     cont         = ovrCamera.GetComponent <CharacterController>();
     fader        = ovrEye.GetComponent <OVRScreenFade>();
     stat         = staticCameras.GetComponent <StaticCamera>();
     offset       = new Vector3(0, 0.05f, 0);
     lastTeleport = Time.time;
 }
示例#3
0
 private static void ActivateFullScreenMode(GraphicsDeviceManager graphics)
 {
     Camera.Reset(DisplayWidth, DisplayHeight);
     StaticCamera.Reset(DisplayWidth, DisplayHeight);
     graphics.PreferredBackBufferHeight = DisplayHeight;
     graphics.PreferredBackBufferWidth  = DisplayWidth;
     graphics.ToggleFullScreen();
     graphics.ApplyChanges();
 }
示例#4
0
        protected override void Initialize()
        {
            ShapeManager.Initialize(graphics);
            ScreenManager.Initialize(defaultWindowWidth, defaultWindowHeight);
            Camera.Initialize();
            StaticCamera.Initialize();

            base.Initialize();
        }
示例#5
0
 private static void ResetScreenToDefaultDimensions(GraphicsDeviceManager graphics)
 {
     Camera.Reset(DefaultWindowWidth, DefaultWindowHeight);
     StaticCamera.Reset(DefaultWindowWidth, DefaultWindowHeight);
     graphics.PreferredBackBufferHeight = DefaultWindowHeight;
     graphics.PreferredBackBufferWidth  = DefaultWindowWidth;
     graphics.ToggleFullScreen();
     graphics.ApplyChanges();
 }
示例#6
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
 }
示例#7
0
        public ModelEditorScene()
        {
            this.debug = new DebugRenderer();

            this.camera = new StaticCamera()
            {
                Eye = new Vector3(16, 6, 16),
                Target = new Vector3(0, 0, 0)
            };
            InitializeComponents();
        }
示例#8
0
        /// <inheritdoc />
        public override void Initialize()
        {
            var screenSize = new Point(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2);

            Camera = new FreeCamera(GraphicsDevice.Viewport.AspectRatio, new Vector3(-250, 100, 700), screenSize);

            CubeMapCamera = new StaticCamera(1f, RobotPosition, Vector3.UnitX, Vector3.Up);
            CubeMapCamera.BuildProjection(1f, 1f, 3000f, MathHelper.PiOver2);

            base.Initialize();
        }
示例#9
0
        public void InitObjects(Game game)
        {
            // スクリプト用のオブジェクト。
            GameObject titleEnterObject = new GameObject();

            // コンポーネントをアタッチ。
            titleEnterObject.AddComponent(new TitleEnterComponent(game));
            AddObject(titleEnterObject);

            // カメラの初期化
            StaticCamera camera = new StaticCamera();

            camera.SetPosition(new Vec3(0, 0, -10));
            AddObject(camera);

            // タイトルのテキスト
            // 色とフォントサイズ、テキストを指定
            TextRenderer titleObject = new TextRenderer(800, 100)
            {
                FontColor = Color.Red,
                FontSize  = 35,
                Text      = "スミス VS たこ焼き 大決戦"
            };

            titleObject
            .SetBounds(new Vec3(8, 1, 0))
            .SetPosition(new Vec3(-3.5f, 2, 0));
            AddObject(titleObject);

            // 'Press Enter..'のテキスト
            TextRenderer pressEnterObject = new TextRenderer(200, 100)
            {
                FontColor = Color.DarkRed,
                Text      = "Press Enter..."
            };

            pressEnterObject
            .SetBounds(new Vec3(2, 1, 0))
            .SetPosition(new Vec3(-1f, -2, 0));
            AddObject(pressEnterObject);

            // バックグラウンドを配置
            RawTexture2D background = new RawTexture2D("Images/sky.png")
            {
                Layer = 1
            };

            background
            .SetBounds(new Vec3(15f, 10f))
            .SetPosition(new Vec3(-5.5f, -4.5f, 0));
            AddObject(background);
        }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // create the cameras
            cameras    = new ICamera[2];
            cameras[0] = new StaticCamera(GraphicsDevice.Viewport);
            cameras[1] = new FollowCamera(GraphicsDevice.Viewport);

            // set the index
            currentCameraIndex = 0;
        }
示例#11
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;

            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }
    }
示例#12
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Palette.MidnightBlack);

            switch (GameMode)
            {
            case Mode.Playfield:
                Playfield.Draw(spriteBatch);
                break;
            }

            StaticCamera.Draw(spriteBatch);
            base.Draw(gameTime);
        }
示例#13
0
        private Scene GetInitScene()
        {
            Scene scene = new Scene();

            scene.AddObject(new SolidBoxObject2D
            {
                BoxColor = Color4.White,
                Position = new Vec3(3f, 3f, 0f),
                Bounds   = new Vec3(1f, 1f, 0f)
            });

            SolidPolygonObject2D poly = new SolidPolygonObject2D
            {
                PoligonColor = Color4.Gold,
                Position     = new Vec3(-3f, -3f, 0f)
            };

            poly.Points.Add(new Vec3(1f, 1.5f, 0));
            poly.Points.Add(new Vec3(0f, 0, 0));
            poly.Points.Add(new Vec3(2f, 0, 0));
            poly.AddComponentUnsafe <PlayerComponent>();
            scene.AddObject(poly);

            scene.AddObject(new PointsObject2D
            {
                Position   = new Vec3(2, 2, 0),
                PointColor = Color4.White,
                PointSize  = 10
            });
            scene.AddObject(new CircleObject2D
            {
                Position    = new Vec3(3.5f, 1f, 0),
                Bounds      = new Vec3(1, 1, 0),
                Radius      = 0.5f,
                CircleColor = Color4.Red
            });
            scene.AddObject(new TextureRender());

            StaticCamera camera = new StaticCamera();

            camera.Position = new Vec3(0, 0, -10f);
            // camera.AddComponent(new ExceptionComponent());
            scene.AddObject(camera);

            scene.Save("scene.json");

            return(scene);
        }
示例#14
0
 public void initStaticCamera()
 {
     if (staticCamera == null)
     {
         GameObject go = GameObject.Find("StaticCanvas");
         if (go == null)
         {
             go      = ResMgr.Instance.load("UI/StaticCanvas") as GameObject;
             go.name = "StaticCanvas";
         }
         staticCamera = go.GetComponent <StaticCamera>();
         if (staticCamera == null)
         {
             staticCamera = go.AddComponent <StaticCamera>();
         }
     }
 }
示例#15
0
        public void InitObjects(Game game)
        {
            // カメラの初期化
            StaticCamera camera = new StaticCamera();

            camera.SetPosition(new Vec3(0, 0, -10));
            AddObject(camera);

            // バックグラウンドを配置
            RawTexture2D background = new RawTexture2D("Images/sky.png")
            {
                Layer = 1
            };

            background
            .SetBounds(new Vec3(15f, 10f))
            .SetPosition(new Vec3(-5.5f, -4.5f, 0));
            AddObject(background);

            // プレイヤーを配置
            RawTexture2D player = new RawTexture2D("Images/smith.png");

            player
            .SetBounds(new Vec3(.8f, 1.3f, 0))
            .SetPosition(new Vec3(-0.5f, -3.0f, 0));
            player.AddComponent(new PlayerComponent(game));
            AddObject(player);

            TextRenderer renderer = new TextRenderer(200, 100)
            {
                FontColor = Color.Red
            };

            renderer
            .SetBounds(new Vec3(2, 1, 0))
            .SetPosition(new Vec3(-3f, 3f, 0));
            AddObject(renderer);

            // スクリプト用オブジェクト
            GameObject components = new GameObject();

            components.AddComponent(new RandomSpawnerComponent());
            components.AddComponent(new TimerComponent(game, renderer));
            AddObject(components);
        }
示例#16
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(PICO8.SkyBlue);

            switch (GameMode)
            {
            case Mode.Menu:
                break;

            case Mode.Playfield:
                Playfield.Draw(spriteBatch);
                HUD.Draw(spriteBatch);
                break;
            }

            StaticCamera.Draw(spriteBatch);
            base.Draw(gameTime);
        }
        /// <inheritdoc />
        public override void Initialize()
        {
            Game.Background = Color.CornflowerBlue;

            // Creates a Static Camera looking at the origin
            Camera = new StaticCamera(GraphicsDevice.Viewport.AspectRatio, Vector3.One * 250f, -Vector3.Normalize(Vector3.One), Vector3.Up);

            // Set the Robot positions
            RobotTwoPosition = new Vector3(-60f, 0f, 0f);
            RobotOnePosition = new Vector3(60f, 0f, 0f);

            // Set the World Matrices for each Robot
            RobotOneWorld = Matrix.CreateTranslation(RobotOnePosition);
            RobotTwoWorld = Matrix.CreateTranslation(RobotTwoPosition);

            // Initialize AABB touching value as false
            AreAABBsTouching = false;

            base.Initialize();
        }
示例#18
0
        public override void Initialise(GraphicsDevice device, ContentManager content)
        {
            Device        = device;
            backdrop      = content.Load <Texture2D>(@"Textures\OITBackdrop");
            oit_pass1     = content.Load <Effect>(@"Shaders\OITPass1");
            oit_pass2     = content.Load <Effect>(@"Shaders\OITPass2");
            oit_pass3     = content.Load <Effect>(@"Shaders\OITPass3");
            batch         = new SpriteBatch(device);
            camera        = new StaticCamera(new Vector3(0, 2, -150), Vector3.Zero, Device.Viewport.AspectRatio, MathHelper.ToRadians(60), 0.5f, 1000.0f);
            oit_colour_rt = new RenderTarget2D(Device, Device.Viewport.Width, Device.Viewport.Height, false, SurfaceFormat.Vector4, DepthFormat.None);
            oit_weight_rt = new RenderTarget2D(Device, Device.Viewport.Width, Device.Viewport.Height, false, SurfaceFormat.Single, DepthFormat.None);

            planes = new QuadPlane[nPlanes];
            for (int i = 0; i < nPlanes; i++)
            {
                float angle = (i * 360.0f) / nPlanes;
                Color c     = ColourSpaces.HSVToRGB(angle, 1, 1);
                planes[i] = new QuadPlane(Vector3.Zero, 80, Vector3.Up, Vector3.Right, c);
            }
            Normal = new BasicEffect(Device);
            Normal.TextureEnabled     = false;
            Normal.VertexColorEnabled = true;
            Normal.LightingEnabled    = false;
            Normal.Projection         = camera.Projection;
            Normal.View = camera.View;

            font = content.Load <SpriteFont>("MenuFont");

            bs.ColorBlendFunction = BlendFunction.Add;

            bs.AlphaSourceBlend = Blend.Zero;
            bs.ColorSourceBlend = Blend.Zero;

            bs.AlphaDestinationBlend = Blend.InverseSourceAlpha;
            bs.ColorDestinationBlend = Blend.InverseSourceAlpha;
        }
示例#19
0
 private void Start()
 {
     fader  = webvrEye.GetComponent <OVRScreenFade>();
     stat   = staticCameras.GetComponent <StaticCamera>();
     offset = new Vector3(0, 0.05f, 0);
 }
示例#20
0
 public Scene()
 {
     Camera = new StaticCamera(1);
     Sun    = new Sun(new Point3D(0f, 150f, 0f), new Color3(255));
     Fog    = new Fog();
 }
示例#21
0
 public Scene(StaticCamera camera, Sun sun)
 {
     Camera = camera;
     Sun    = sun;
     Fog    = new Fog();
 }
示例#22
0
 void Start()
 {
     CMVcam     = GetComponent <CinemachineVirtualCamera>();
     transposer = CMVcam.GetCinemachineComponent <CinemachineFramingTransposer>();
     instance   = this;
 }