예제 #1
0
        protected override void OnStart()
        {
            scene         = new Scene();
            layer         = new Layer2D();
            layer2        = new Layer2D();
            textureObject = new TextureObject2D
            {
                Texture = Engine.Graphics.CreateTexture2D(CloudTexturePath)
            };
            textObject = new TextObject2D
            {
                Font = Engine.Graphics.CreateFont("Data/Font/meiryoTest.aff")
            };
            geometoryObject = new GeometryObject2D
            {
                Shape = new RectangleShape()
                {
                    DrawingArea = new RectF(0, 0, 100, 100)
                }
            };

            Engine.ChangeScene(scene);
            scene.AddLayer(layer);
            scene.AddLayer(layer2);
            layer.AddObject(textureObject);
            layer.AddObject(textObject);
            layer.AddObject(geometoryObject);

            var tex  = textureObject.Texture;
            var font = textObject.Font;
            var col  = geometoryObject.Color;
        }
예제 #2
0
        ////=============================================================================
        //// Private Method
        ////
        ////=============================================================================

        /// <summary>
        /// 背景の初期化
        /// </summary>
        private void InitializeBackground()
        {
            var obj = new TextureObject2D();

            obj.Texture = Engine.Graphics.CreateTexture2D("Resources/CompletedBackground.png");
            _mainLayer.AddObject(obj);
        }
예제 #3
0
        private void PlaceVectors(NumberVector start)
        {
            //float angleSpan = 137.507f;
            float angleSpan = 360 / 72.0f;

            for (int i = 2; i <= 72; i++)
            {
                var vector   = NumberVector.CreateForNumber(i);
                var distance = (vector - start).GetLength();

                var position = new Vector2DF(1, 1);
                position.Degree = angleSpan * i;
                position.Length = distance * DistanceUnit;
                position       += new Vector2DF(320, 320);

                var obj = new TextObject2D()
                {
                    Text            = i.ToString(),
                    Font            = font,
                    Position        = position,
                    Color           = vector.IsPrime() ? Helper.AccentColor1 : Helper.PlaneColor,
                    DrawingPriority = 2,
                };
                var size = font.CalcTextureSize(i.ToString(), WritingDirection.Horizontal);
                obj.CenterPosition = size.To2DF() / 2;

                layer.AddObject(obj);
            }
        }
예제 #4
0
        protected override void OnRegistered()
        {
            Layer2D back = new Layer2D();
            Layer2D text = new Layer2D();

            // 背景を設定する
            back.AddPostEffect(
                new Background(
                    new Vector3DF(0.0f, 0.4f, 1.0f),
                    new Vector3DF(0.4f, 0.7f, 1.0f)
                    )
                );

            // テキストの中心座標をオブジェクトの中心にする
            Vector2DF center = new Vector2DF(0.5f, 0.5f);

            // 「Aero Groovers」
            AGText title = new AGText(120, 4, center);

            title.SetText("Aero Groovers");
            title.Position = new Vector2DF(640, 150);
            text.AddObject(title);

            // 「Press Any Button.」
            AGText announce = new AGText(72, 4, center);

            announce.SetText("Press Any Button.");
            announce.Position = new Vector2DF(640, 600);
            text.AddObject(announce);

            // レイヤーを追加する
            AddLayer(back);
            AddLayer(text);
        }
예제 #5
0
 public static void ShotTypeB(int count, Vector2DF pos, Layer2D gameLayer)
 {
     if (count % 10 == 0)
     {
         var bulletPos = new asd.Vector2DF(pos.X, pos.Y + 30);
         gameLayer.AddObject(new Bullet(bulletPos, +90));
         gameLayer.AddObject(new Bullet(bulletPos, +110));
         gameLayer.AddObject(new Bullet(bulletPos, +70));
     }
 }
예제 #6
0
        public GameScene()
        {
            Layer2D back = new Layer2D();

            back.AddPostEffect(
                new Background(
                    new Vector3DF(1.0f, 1.0f, 0.0f),
                    new Vector3DF(1.0f, 1.0f, 0.6f)
                    )
                );

            AddLayer(back);

            Skill.Game = Game;

            for (int i = 0; i < 4; ++i)
            {
                if (Game.Player[i] != null)
                {
                    // プレイヤー情報を初期化
                    var d = Game.Player[i].Difficulty;
                    var c = Game.Score.Notes[d].Count;
                    Game.Player[i].Initialize(c);

                    AddLayer(new PlayLayer(i));
                    AddLayer(new UILayer(i));
                }
            }

            // あらかじめポーズのためにレイヤーを用意
            PauseLayer.AddObject(new PauseWindow {
                Resume = Resume
            });

            PauseLayer.AddObject(new GeometryObject2D
            {
                Shape = new RectangleShape {
                    DrawingArea = new RectF(0, 0, 1280, 800)
                },
                Color = new Color(0, 0, 0, 127)
            });

            EffectLayer.DrawingPriority = 9;
            AddLayer(EffectLayer);
            AddLayer(PauseLayer);

            // ゲームを初期化
            Reset();
        }
예제 #7
0
        protected override void OnStart()
        {
            var scene = new Scene();
            var layer = new Layer2D();

            var obj1 = GetObject(160);
            var obj2 = GetObject(480);

            Engine.ChangeScene(scene);
            scene.AddLayer(layer);
            layer.AddObject(obj1.Item1);
            layer.AddObject(obj2.Item1);

            obj2.Item2.Vanish();
        }
예제 #8
0
        public BattleController(BattleContext context)
        {
            var random = new Random();

            Layer = new Layer2D();
            Scene = new Scene();
            coordinateConverter = new ModelToViewCoordinateConverter();
            headerFont          = Engine.Graphics.CreateFont("Fonts/Header.aff");
            planeFont           = Engine.Graphics.CreateFont("Fonts/Body.aff");

            var background = new GeometryObject2D()
            {
                Shape = new RectangleShape
                {
                    DrawingArea = new RectF(0, 0, 1280, 720),
                },
                Color           = new Color(255, 255, 255),
                DrawingPriority = -2
            };

            Layer.AddObject(background);

            var localPlayerProfileObject = new TextureObject2D()
            {
                Position = new Vector2DF(1280, 720),
            };
            var remotePlayerProfileObject = new TextureObject2D()
            {
                Position = new Vector2DF(0, 0),
                Angle    = 180,
            };

            Layer.AddObject(localPlayerProfileObject);
            Layer.AddObject(remotePlayerProfileObject);

            for (int i = 0; i < context.LocalPlayer.Tokens.Length; i++)
            {
                var token = context.LocalPlayer.Tokens[i];
                ShowToken(random, token, localPlayerProfileObject, i);
            }
            for (int i = 0; i < context.RemotePlayer.Tokens.Length; i++)
            {
                var token = context.RemotePlayer.Tokens[i];
                ShowToken(random, token, remotePlayerProfileObject, i);
            }

            Scene.AddLayer(Layer);
        }
예제 #9
0
        private void ShowToken(Random random, BattleToken token, Object2D parent, int index)
        {
            var tokenObj = new BattleTokenView(token);

            Tokens[token.Index] = tokenObj;
            Layer.AddObject(tokenObj);

            var x = (float)random.NextDouble() * 2 - 1;
            var y = (float)random.NextDouble() * 2 - 1;

            tokenObj.Position = coordinateConverter.Convert(new Vector2DF(x, y));

            var profileObj = new ProfileCardView(token, headerFont, planeFont);

            Profiles[token.Index] = profileObj;
            parent.AddChild(profileObj, ChildManagementMode.Disposal | ChildManagementMode.RegistrationToLayer,
                            ChildTransformingMode.All);

            var sizeX = 160.0f;
            var px    = (index % 2) * (sizeX + 4);
            var py    = (index / 2) * (sizeX * 1.61805f + 4);

            profileObj.Position = new Vector2DF(-px, -py) - new Vector2DF(sizeX, sizeX * 1.61805f);

            var scale = sizeX / profileObj.CardSize.X;

            profileObj.Scale = new Vector2DF(scale, scale);
        }
예제 #10
0
파일: Profiler.cs 프로젝트: wraikny/Altseed
        protected override void OnStart()
        {
            var scene  = new Scene();
            var layer1 = new Layer2D()
            {
                Name = "Test1"
            };
            var layer2 = new Layer2D()
            {
                Name = "Test2"
            };

            var texture = Engine.Graphics.CreateTexture2D(CloudTexturePath);

            for (int i = 0; i < 100; i++)
            {
                var obj = new TextureObject2D
                {
                    Texture = texture,
                };
                layer1.AddObject(obj);
            }

            Engine.ChangeScene(scene);
            scene.AddLayer(layer1);
            scene.AddLayer(layer2);

            Console.WriteLine("Writeで負荷を掛けます");
        }
예제 #11
0
        public static void ShotTypeA(int count, Vector2DF pos, Layer2D gameLayer)
        {
            if (count % 7 == 0)
            {
                for (int i = 0; i < 12; i++)
                {
                    var angle     = 2 * Math.PI * (i / 12.0f);
                    var bulletPos = pos + 36.0f * new asd.Vector2DF((float)Math.Cos(angle), (float)Math.Sin(angle));

                    angle *= 360.0f / (2 * Math.PI); // rad to degree

                    if ((count / 30) % 3 == 0)
                    {
                        angle       += 90;
                        bulletPos.X += 0.0f;
                    }
                    else if ((count / 30) % 3 == 1)
                    {
                        angle       -= 90;
                        bulletPos.X -= 0.0f;
                    }
                    else
                    {
                    }
                    gameLayer.AddObject(new Bullet(bulletPos, (float)angle));
                }
            }
        }
        protected override void OnStart()
        {
            var scene = new Scene();
            var layer = new Layer2D();
            var obj   = new TextureObject2D();

            camera = new CameraObject2D();

            obj.Texture = Engine.Graphics.CreateTexture2D("Data/Texture/Sample1.png");
            camera.Src  = new RectI(100, 100, 312, 312);
            camera.Dst  = new RectI(10, 10, 200, 160);

            layer.AddObject(obj);
            layer.AddObject(camera);
            scene.AddLayer(layer);
            Engine.ChangeScene(scene);
        }
예제 #13
0
        protected override void OnRegistered()
        {
            MaskLayer.AddObject(new GeometryObject2D
            {
                Shape = new RectangleShape {
                    DrawingArea = new RectF(0, 0, 960, 720)
                },
                Color = new Color(0, 0, 0, (int)((100 - Configuration.Luminance) * 2.55))
            });

            for (int i = 0; i < 24; ++i)
            {
                Keys[] keys =
                {
                    Keys.Q,         Keys.A,           Keys.W,          Keys.S,            Keys.E, Keys.D, Keys.R, Keys.F, Keys.T, Keys.G,
                    Keys.Y,         Keys.H,           Keys.U,          Keys.J,            Keys.I, Keys.K, Keys.O, Keys.L, Keys.P,
                    Keys.Semicolon, Keys.LeftBracket, Keys.Apostrophe, Keys.RightBracket, Keys.Backslash
                };

                EffectLayer.AddObject(new PressEffect(keys[i])
                {
                    Position = new Vector2DF(135 + 30 * i, 600)
                });
            }

            AddLayer(MaskLayer);
            AddLayer(GroundLayer);
            AddLayer(NoteLayer);
            AddLayer(InfoLayer);
            AddLayer(EffectLayer);
            AddLayer(PauseLayer);

            Result = new Result(Score[Difficulty]);

            Note.HighSpeed       = Configuration.HighSpeed;
            Note.Ofset           = Configuration.Ofset;
            Note.IsAutoPlaying   = Configuration.AutoMode;
            Note.NoteTimer.Ofset = Score[Difficulty].Ofset;

            // ノートタイマーの初期化
            Note.NoteTimer.Stop();
            Note.NoteTimer.Reset();

            //コルーチンを用意
            Coroutine = GetCoroutine();
        }
예제 #14
0
        protected override void OnStart()
        {
            var obj1 = new CollidingObject1();

            obj1.Position = new Vector2DF(320, 240);
            var obj2 = new CollidingObject2();

            obj2.Position = new Vector2DF(600, 20);

            var scene = new Scene();
            var layer = new Layer2D();

            Engine.ChangeScene(scene);
            scene.AddLayer(layer);
            layer.AddObject(obj1);
            layer.AddObject(obj2);
        }
예제 #15
0
        protected override void OnStart()
        {
            var scene            = new Scene();
            var layer            = new Layer2D();
            var obj              = new MyObject(100, 128);
            var notDrawnObject   = new MyObject(300, 128);
            var notUpdatedObject = new MyObject(500, 128);

            notDrawnObject.IsDrawn     = false;
            notUpdatedObject.IsUpdated = false;

            layer.AddObject(obj);
            layer.AddObject(notDrawnObject);
            layer.AddObject(notUpdatedObject);
            scene.AddLayer(layer);
            Engine.ChangeScene(scene);
        }
예제 #16
0
        protected override void OnRegistered()
        {
            Layer2D back   = new Layer2D();
            Layer2D text   = new Layer2D();
            Layer2D window = new Layer2D();

            // 背景を設定する
            back.AddPostEffect(
                new Background(
                    new Vector3DF(0.0f, 0.4f, 1.0f),
                    new Vector3DF(0.4f, 0.7f, 1.0f)
                    )
                );

            // テキストの中心座標をオブジェクトの中心にする
            Vector2DF center = new Vector2DF(0.5f, 0.5f);

            // 「ENTRY」
            AGText title = new AGText(72, 4, center);

            title.SetText("ENTRY");
            title.Position = new Vector2DF(640, 70);
            text.AddObject(title);

            // 「コントローラーを登録します。準備ができたらスタートボタンを長押ししてください。」
            AGText announce = new AGText(36, 4, center);

            announce.SetText("コントローラーを登録します。\n準備ができたらスタートボタンを長押ししてください。");
            announce.Position = new Vector2DF(640, 720);
            text.AddObject(announce);

            // ウィンドウを追加する
            for (int i = 1; i <= 4; ++i)
            {
                window.AddObject(new EntryWindow(i)
                {
                    NoisyValue = 0.025f
                });
            }

            // レイヤーを追加する
            AddLayer(back);
            AddLayer(text);
            AddLayer(window);
        }
예제 #17
0
        protected override void OnStart()
        {
            scene_ = new Scene();
            var layer = new Layer2D();

            layer.AddObject(new DisposingObject());
            scene_.AddLayer(layer);
            Engine.ChangeScene(scene_);
        }
예제 #18
0
        protected override void OnStart()
        {
            var scene = new Scene();
            var layer = new Layer2D();
            var obj   = new HogeObject();

            Engine.ChangeScene(scene);
            scene.AddLayer(layer);
            layer.AddObject(obj);
        }
예제 #19
0
        protected override void OnStart()
        {
            var layer = new Layer2D();
            var obj1  = new TextureObject2D();
            var obj2  = new TextureObject2D();

            layer.AddObject(obj1);
            obj1.AddChild(obj2, ChildManagementMode.Nothing, ChildTransformingMode.All);
            Assert.AreEqual(layer, obj2.Layer);
        }
예제 #20
0
 public FixedUIComponent(string scene_title)
 {
     UILayer = new Layer2D {
         DrawingPriority = 2
     };
     UILayer.AddObject(new HeadUpDaisy(72, 4, new Vector2DF(0.5f, 0))
     {
         Text     = scene_title,
         Position = new Vector2DF(480, 10)
     });
 }
예제 #21
0
        protected override void OnRegistered()
        {
            //レイヤ初期化
            characterLayer = new Layer2D();
            bulletLayer    = new Layer2D();
            UILayer        = new Layer2D();

            //レイヤを設定
            AddLayer(characterLayer);
            AddLayer(bulletLayer);
            AddLayer(UILayer);

            //プレイヤーと敵を生成
            Player player = new Player(this);

            characterLayer.AddObject(player);

            Enemy enemy = new Enemy(player, this);

            characterLayer.AddObject(enemy);
        }
예제 #22
0
        protected override void OnStart()
        {
            var scene = new Scene();
            var layer = new Layer2D();
            var obj   = new TextureObject2D();

            Engine.ChangeScene(scene);
            scene.AddLayer(layer);
            layer.AddObject(obj);

            AssertMembers(obj);
        }
예제 #23
0
        protected override void OnStart()
        {
            var scene = new Scene();

            layer1 = new MessageLayer()
            {
                Name = "Layer1"
            };
            var layer2 = new MessageLayer()
            {
                Name = "Layer2"
            };

            obj1 = new MessageObject("Object1");
            var obj2 = new MessageObject("Object2");

            Engine.ChangeScene(scene);
            scene.AddLayer(layer1);
            scene.AddLayer(layer2);
            layer1.AddObject(obj1);
            layer1.AddObject(obj2);
        }
예제 #24
0
        protected override void OnStart()
        {
            scene = new Scene();
            layer = new Layer2D();
            var obj = new TextureObject2D()
            {
                Texture = Engine.Graphics.CreateTexture2D(CloudTexturePath)
            };

            layer.AddObject(obj);
            scene.AddLayer(layer);
            Engine.ChangeScene(scene);
        }
        protected override void OnStart()
        {
            var scene = new Scene();
            var layer = new Layer2D();
            var child = new TextureObject2D();

            parent = new TextureObject2D();

            parent.AddChild(child, ChildMode.All);
            layer.AddObject(parent);
            layer.AddObject(child);
            scene.AddLayer(layer);
            Engine.ChangeScene(scene);

            var texture = Engine.Graphics.CreateTexture2D(CloudTexturePath);

            parent.Position       = new Vector2DF(320, 240);
            parent.CenterPosition = new Vector2DF(128, 128);
            parent.Texture        = texture;

            child.Position = new Vector2DF(50, 50);
            child.Texture  = texture;
        }
예제 #26
0
        protected override void OnStart()
        {
            var scene = new Scene();
            var layer = new Layer2D();
            var obj   = new ObjectAddingObject();

            Engine.ChangeScene(scene);
            scene.AddLayer(layer);
            layer.AddObject(obj);

            scene.AddComponent(new ComponentAddingScene(), "Add");
            layer.AddComponent(new ComponentAddingLayer(), "Add");
            obj.AddComponent(new ComponentAddingObject(), "Add");
        }
예제 #27
0
        protected override void OnStart()
        {
            var scene = new Scene();
            var layer = new Layer2D();
            var obj   = new TextureObject2D
            {
                Texture = Engine.Graphics.CreateTexture2D(CloudTexturePath)
            };

            scene.AddComponent(new MyComponent(), "LifeCycle");

            layer.AddObject(obj);
            scene.AddLayer(layer);
            Engine.ChangeSceneWithTransition(scene, new TransitionFade(0.2f, 0.2f));
        }
        private Tuple <Layer2D, MyComponent> CreateSampleLayer(float x)
        {
            var layer = new Layer2D();
            var obj   = new TextureObject2D
            {
                Position = new Vector2DF(x, 240),
                Texture  = Engine.Graphics.CreateTexture2D(CloudTexturePath),
            };
            var component = new MyComponent();

            layer.AddObject(obj);
            layer.AddComponent(component, "Black");

            return(Tuple.Create(layer, component));
        }
예제 #29
0
        private static void SetUpBackground(Layer2D layer)
        {
            var back = new GeometryObject2D()
            {
                Position = new Vector2DF(0, 0),
                Shape    = new RectangleShape()
                {
                    DrawingArea = new RectF(0, 0, 640, 640),
                },
                Color           = Helper.BackGroundColor,
                DrawingPriority = -1
            };

            layer.AddObject(back);
        }
예제 #30
0
        protected override void OnRegistered()
        {
            //単一のレイヤ
            Layer2D layer = new Layer2D();

            AddLayer(layer);

            //テキスト表示
            TextObject2D text = new TextObject2D();

            text.Font     = Engine.Graphics.CreateFont("Resource/test.aff");
            text.Text     = "Zキーでスタート";
            text.Position = new Vector2DF(10, 100);

            layer.AddObject(text);
        }