コード例 #1
0
ファイル: SpriteRenderer.cs プロジェクト: Gkowloon/Raysist
 /// <summary>
 /// @brief コンストラクタ
 /// </summary>
 /// <param name="container">コンテナ</param>
 /// <param name="path">ファイルの場所</param>
 public SpriteRenderer(GameContainer container, String path)
     : base(container)
 {
     GraphicHandle = DX.LoadGraph("Resources\\" + path);
     Scale = 1.0f;
     Radian = 0.0f;
 }
コード例 #2
0
        private void DealDamage(int amount, CharacterAccount to)
        {
            CharacterAccount from    = selectedCharacter;
            DamageType       dmgType = (DamageType)cbDamageTypeList.SelectedItem;

            GameContainer.DealDamage(from, to, amount, dmgType);
        }
コード例 #3
0
        public void DamageTakenModTest()
        {
            Setup.SetupTestInfrastructure();
            ActiveGame activeGame = GameContainer.ActiveGame;

            try
            {
                AmountModifier   damageTakenMod = new AmountModifier("HeavyPlating", "Decrease damage taken by 1", ModifierTargets.Local, AmountModifierType.DamageTaken, -1, false);
                CharacterAccount fromAccount    = activeGame.AllTargets[43];
                CharacterAccount toAccount      = activeGame.AllTargets[87];
                GameContainer.AddDamageTakenModifier(damageTakenMod, toAccount);

                GameContainer.DealDamage(fromAccount, toAccount, 4, DamageType.Melee);

                int expectedHealth = 12;
                int actualhealth   = toAccount.CurrentHealth;
                Assert.IsTrue(expectedHealth == actualhealth, $"{toAccount.Name} health doesn't match expected health. Expected {expectedHealth}, actually {actualhealth}");

                int expectedMod = -1;
                int actualMod   = toAccount.DamageTakenMod;
                Assert.IsTrue(expectedMod == actualMod, $"{toAccount.Name} damage taken mod doesn't match expected mod. Expected {expectedMod}, actually {actualMod}");
            }
            catch (Exception e)
            {
                Assert.Fail("Test failed: " + e);
            }
        }
コード例 #4
0
ファイル: Laser.cs プロジェクト: himeiyuna/Raysist
        //ここまで
        //----------------------------------------------------
        /// <summary>
        /// @brief コンストラクタ
        /// </summary>
        public Laser(GameContainer container, Vector3 pos, float direction, float speed)
            : base(container)
        {
            Position.LocalPosition = pos;
            Direction = direction;
            Speed = speed;
            State = 0;
            Trail = new Queue<Vector3>();
            var s_pos = DX.ConvWorldPosToScreenPos(Position.WorldPosition.ToDxLib);
            DrawCorner = new Vector3[4] { Vector3.ToVector3(ref s_pos), Vector3.ToVector3(ref s_pos), Vector3.ToVector3(ref s_pos), Vector3.ToVector3(ref s_pos) };

            GraphicHandle = DX.LoadGraph("Resources\\dummy.png");
            int w = 0, h = 0;
            DX.GetGraphSize(GraphicHandle, out w, out h);
            Height = h;
            Width = w;

            //画像の高さから分割数を計算
            int nPiece = Height / NumDivideLaser;

            //分割数の分だけ配列を確保し、分割したレーザー画像ハンドルを格納
            LaserPiece = new int[nPiece];
            for (int i = 0; i < nPiece; i++)
            {
                LaserPiece[i] = DX.DerivationGraph(0, i * NumDivideLaser, Width, NumDivideLaser, GraphicHandle);
            }
        }
コード例 #5
0
ファイル: Shot.cs プロジェクト: himeiyuna/Raysist
 //ここまで
 //----------------------------------------------------
 /// <summary>
 /// @brief コンストラクタ
 /// angle :角度
 /// speed :弾速
 /// pos   :発射位置
 /// </summary>
 public Shot(GameContainer container, float angle, float speed, Vector3 pos)
     : base(container)
 {
     Position.LocalPosition = pos;
     Angle = angle;
     Speed = speed;
 }
コード例 #6
0
        public void HealGlobalVillainTargetsModTest()
        {
            Setup.SetupTestInfrastructure();
            ActiveGame activeGame = GameContainer.ActiveGame;

            try
            {
                AmountModifier   healthModifier = new AmountModifier("Obsidion Field", "Increase all damage by 1", ModifierTargets.VillainTargets, AmountModifierType.DamageGiven, 1, false);
                CharacterAccount fromAccount    = activeGame.AllTargets[43];
                CharacterAccount toAccount      = activeGame.AllTargets[87];
                GameContainer.AddHealthModifier(healthModifier, fromAccount);


                Assert.IsTrue(!activeGame.GlobalEnvironmentModifiers.ContainsValue(healthModifier), "Global Environment Mods List incorrectly contains expected modifier");
                Assert.IsTrue(!activeGame.GlobalHeroModifers.ContainsValue(healthModifier), "Global Environment Mods List incorrectly contains expected modifier");
                Assert.IsTrue(activeGame.GlobalVillainModifiers.ContainsValue(healthModifier), "Global Environment Mods List does not contain expected modifier");

                foreach (CharacterAccount characterAccount in activeGame.VillainTargets)
                {
                    Assert.IsTrue(characterAccount.HealingModList.ContainsValue(healthModifier), $"{characterAccount} does not contain the expected modifier");
                }
            }
            catch (Exception e)
            {
                Assert.Fail("Test failed: " + e);
            }
        }
コード例 #7
0
ファイル: Shot.cs プロジェクト: himeiyuna/Raysist
 /// <summary>
 /// @brief コンストラクタ
 /// Direction : 向き
 /// speed :弾速
 /// pos   :発射位置
 /// </summary>
 public Shot(GameContainer container, Vector2 direction, float speed, Vector3 pos)
     : base(container)
 {
     Position.LocalPosition = pos;
     Direction = direction;
     Speed = speed;
 }
コード例 #8
0
ファイル: Bit.cs プロジェクト: himeiyuna/Raysist
        /// <summary>
        /// @brief コンストラクタ
        /// </summary>
        /// <param name="container">自身を組み込むコンテナ</param>
        /// <param name="player">親</param>
        /// <param name="position">初期位置</param>
        public Bit(GameContainer container, Player player, BitIndex index, GameContainer lazer)
            : base(container)
        {
            Energy = MaxEnergy;      // 2秒分
            Player = player;
            Index = index;
            ShotCounter = 0;
            Speed = 5.0f;

            Rot = 90;
            Angle = Rot * -(float)Math.PI / 180;
            Lazer = lazer;

            IsDock = true;

            if (index == BitIndex.BIT_LEFT)
            {
                Position.LocalPosition = new Vector3 { x = -10.0f, y = -5.0f, z = 0.0f };
                container.Name = "BitLeft";
            }
            else
            {
                Position.LocalPosition = new Vector3 { x = 10.0f, y = -5.0f, z = 0.0f };
                container.Name = "BitRight";
            }
        }
コード例 #9
0
        public void LoadGame(string gameName, GameRunningType grt)
        {
            Debug.Log("Load game" + gameName + " |  editMode: " + grt.ToString());
            Vuforia.VuforiaBehaviour.Instance.enabled = true;
            _currentGC = GameContainer.Load(gameName);
            _currentGameRunningType = grt;
            DefaultTrackableEventHandler[] tehs = GameObject.FindObjectsOfType <DefaultTrackableEventHandler>();
            foreach (var teh in tehs)
            {
                teh.Reload();
            }
            switch (grt)
            {
            case GameRunningType.Edit:
                ScreenSpaceUIManager.Instance.ShowUI(ScreenSpaceUIManager.UIType.Edit);
                break;

            case GameRunningType.Play:
                List <string> snames = new List <string>();
                foreach (var sc in _currentGC.scenes)
                {
                    snames.Add(sc.name);
                }
                foreach (var teh in tehs)
                {
                    if (!snames.Contains(teh.name))
                    {
                        teh.gameObject.SetActive(false);
                    }
                }
                ScreenSpaceUIManager.Instance.ShowUI(ScreenSpaceUIManager.UIType.Player);
                break;
            }
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: samuelgecik/OOP
        static void Main(string[] args)
        {
            GameContainer container = new GameContainer("window", 650, 400); //constructor, creates new instance of the game
            Gravity       gravity   = new Gravity();

            container.GetWorld().SetPhysics(gravity);

            Player player = new Player("player", 1);

            container.GetWorld().AddActor(player);
            player.SetPhysics(true);
            player.SetPosition(220, 100);

            Skeleton enemy = new Skeleton("skelton", 1, player, 5, 20, 20);

            container.GetWorld().AddActor(enemy);
            enemy.SetPhysics(true);
            enemy.SetPosition(300, 100);

            container.SetMap("resources/maps/map01.tmx");

            Action <IWorld> setCamera = world =>
            {
                world.CenterOn(world.GetActors().Find(a => a.GetName() == "player"));
            };

            container.Run(); //start the game, infinite loop, no change is accepted after this until the game ends
        }
コード例 #11
0
        public void DamageGivenGlobalAllTargetsModTest()
        {
            Setup.SetupTestInfrastructure();
            ActiveGame activeGame = GameContainer.ActiveGame;

            try
            {
                AmountModifier   damageGivenMod = new AmountModifier("Obsidion Field", "Increase all damage by 1", ModifierTargets.AllTargets, AmountModifierType.DamageGiven, 1, false);
                CharacterAccount fromAccount    = activeGame.AllTargets[43];
                CharacterAccount toAccount      = activeGame.AllTargets[87];
                GameContainer.AddDamageGivenModifier(damageGivenMod, fromAccount);

                GameContainer.DealDamage(fromAccount, toAccount, 4, DamageType.Melee);

                int expectedHealth = 10;
                int actualhealth   = toAccount.CurrentHealth;
                Assert.IsTrue(expectedHealth == actualhealth, $"{toAccount.Name} health doesn't match expected health. Expected {expectedHealth}, actually {actualhealth}");

                int expectedMod = 1;
                int actualMod   = fromAccount.DamageGivenMod;
                Assert.IsTrue(expectedMod == actualMod, $"{fromAccount.Name} damage given mod doesn't match expected mod. Expected {expectedMod}, actually {actualMod}");
                Assert.IsTrue(activeGame.GlobalEnvironmentModifiers.ContainsValue(damageGivenMod), "Global Environment Mods List does not contain expected modifier");
                Assert.IsTrue(activeGame.GlobalHeroModifers.ContainsValue(damageGivenMod), "Global Environment Mods List does not contain expected modifier");
                Assert.IsTrue(activeGame.GlobalVillainModifiers.ContainsValue(damageGivenMod), "Global Environment Mods List does not contain expected modifier");

                foreach (CharacterAccount characterAccount in activeGame.AllTargets.Values)
                {
                    Assert.IsTrue(characterAccount.DamageGivenModList.ContainsValue(damageGivenMod), $"{characterAccount} does not contain the expected modifier");
                }
            }
            catch (Exception e)
            {
                Assert.Fail("Test failed: " + e);
            }
        }
コード例 #12
0
        private void NewGame()
        {
            HeroTargets        = new ObservableCollection <CharacterAccount>();
            NonHeroTargets     = new ObservableCollection <CharacterAccount>();
            AllTargets         = new ObservableCollection <CharacterAccount>();
            VillainTargets     = new ObservableCollection <CharacterAccount>();
            EnvironmentTargets = new ObservableCollection <CharacterAccount>();


            AddBaseIndicesToAllTargets();

            GameContainer.SetupGame();
            SelectCharacters sc = new SelectCharacters(this);

            sc.ShowDialog();
            lbHeroTargets.ItemsSource           = HeroTargets;
            lbNonHeroTargets.ItemsSource        = NonHeroTargets;
            cbDamageAllTargetList.ItemsSource   = AllTargets;
            cbDamageTypeList.ItemsSource        = Enum.GetValues(typeof(DamageType));
            cbDamageAllTargetList.SelectedIndex = 0;
            cbHealAllTargetList.ItemsSource     = AllTargets;
            cbHealAllTargetList.SelectedIndex   = 0;
            cbDamageTypeList.SelectedIndex      = 1;
            tbDmgAmount.Text            = "0";
            tbHealAmount.Text           = "0";
            lbGlobalModList.ItemsSource = GameContainer.ActiveGame.GlobalAllModifiers;

            if (HeroTargets.Count > 0)
            {
                lbHeroTargets.SelectedIndex = 0;
                selectedCharacter           = (CharacterAccount)lbHeroTargets.SelectedItem;
                UpdateSelection();
            }
        }
コード例 #13
0
        public void HealOneTimeModTest()
        {
            Setup.SetupTestInfrastructure();
            ActiveGame activeGame = GameContainer.ActiveGame;

            try
            {
                AmountModifier   healthMod   = new AmountModifier("Healing Field", "Increase next healing by 1", ModifierTargets.Local, AmountModifierType.Health, 1, true);
                CharacterAccount fromAccount = activeGame.AllTargets[43];
                CharacterAccount toAccount   = activeGame.AllTargets[87];
                GameContainer.AddHealthModifier(healthMod, toAccount);

                GameContainer.DealDamage(fromAccount, toAccount, 4, DamageType.Melee);

                GameContainer.HealCharacter(toAccount, toAccount, 1);

                int expectedHealth = 13;
                int actualhealth   = toAccount.CurrentHealth;
                Assert.IsTrue(expectedHealth == actualhealth, $"{toAccount.Name} health doesn't match expected health. Expected {expectedHealth}, actually {actualhealth}");

                int expectedMod = 0;
                int actualMod   = toAccount.HealthMod;
                Assert.IsTrue(expectedMod == actualMod, $"{toAccount.Name} health mod doesn't match expected mod. Expected {expectedMod}, actually {actualMod}");
            }
            catch (Exception e)
            {
                Assert.Fail("Test failed: " + e);
            }
        }
コード例 #14
0
        public void ImmunityTypeSpecificModTest()
        {
            Setup.SetupTestInfrastructure();
            ActiveGame activeGame = GameContainer.ActiveGame;

            try
            {
                ImmunityModifier immunityMod = new ImmunityModifier("Flesh of the Sun God", "Ra is Immune to Fire Damage", ModifierTargets.Local, DamageType.Fire);
                CharacterAccount fromAccount = activeGame.AllTargets[43];
                CharacterAccount toAccount   = activeGame.AllTargets[87];
                GameContainer.AddDamageImmunityModifier(immunityMod, toAccount);

                GameContainer.DealDamage(fromAccount, toAccount, 4, DamageType.Melee);

                int expectedHealth = 11;
                int actualhealth   = toAccount.CurrentHealth;
                Assert.IsTrue(expectedHealth == actualhealth, $"{toAccount.Name} health doesn't match expected health for Melee test. Expected {expectedHealth}, actually {actualhealth}");

                GameContainer.DealDamage(fromAccount, toAccount, 4, DamageType.Fire);

                expectedHealth = 11;
                actualhealth   = toAccount.CurrentHealth;
                Assert.IsTrue(expectedHealth == actualhealth, $"{toAccount.Name} health doesn't match expected health for Fire test. Expected {expectedHealth}, actually {actualhealth}");
            }
            catch (Exception e)
            {
                Assert.Fail("Test failed: " + e);
            }
        }
コード例 #15
0
ファイル: DisappearEnemy.cs プロジェクト: himeiyuna/Raysist
 /// <summary>
 /// @brief コンストラクタ
 /// </summary>
 /// <param name="container">コンテナ</param>
 /// <param name="to">目的地</param>
 /// <param name="accel">加速度</param>
 public DisappearEnemy(GameContainer container, Vector3 to, float accel)
     : base(container, false)
 {
     To = to;
     Accel = accel;
     Diff = new Vector3();
 }
コード例 #16
0
 public MouseInputService(GameContainer container)
 {
     Container   = container;
     directInput = new DirectInput();
     device      = new Mouse(directInput);
     device.Acquire();
 }
コード例 #17
0
ファイル: RaypierTrail.cs プロジェクト: himeiyuna/Raysist
        public override GameContainer Create()
        {
            var gc = new GameContainer(Parent);

            gc.Position.LocalPosition = Bit.Position.WorldPosition;
            gc.Position.LocalPosition.z = 0.0f;
            gc.AddComponent(new RaypierTrail(gc, Bit.Angle));
            var br = new BillboardRenderer(gc, "dummy2.png");
            br.Scale = 32.0f;
            gc.AddComponent(br);
            var bra = new BillboardRenderer(gc, "dummy2.png");
            bra.Scale = 16.0f;
            gc.AddComponent(bra);
            var col = new RectCollider(gc, (Collider g) =>
            {
                DX.DrawString(0, 400, "hit", DX.GetColor(255, 255, 255));
                var a = g.Container.GetComponent<EnemyInformation>();
                if(a != null){
                    a.Damage(10);
                    GameContainer.Destroy(gc);
                }

            });

            col.Width = 64.0f;
            col.Height = 64.0f;

            gc.AddComponent(col);

            Option(gc);

            return gc;
        }
        public IObservable <Unit> GlobalSequentialLoad(GameContainer gameContainer)
        {
            globalVaccineData = new GlobalVaccine();

            return(Observable.FromCoroutine <Unit>(observer => TurnGlobalData(observer, gameContainer.globalManager.countryData.codeCountry))
                   .Do(_ => Debug.Log("Get global vaccination data in " + URL_DATA)));
        }
コード例 #19
0
        public void DamageImmunityGlobalEnvironmentTargetsModTest()
        {
            Setup.SetupTestInfrastructure();
            ActiveGame activeGame = GameContainer.ActiveGame;

            try
            {
                ImmunityModifier DamageImmunityMod = new ImmunityModifier("Obsidion Field", "Increase all damage by 1", ModifierTargets.EnvironmentTargets, DamageType.All);
                CharacterAccount fromAccount       = activeGame.AllTargets[43];
                CharacterAccount toAccount         = activeGame.AllTargets[87];
                GameContainer.AddDamageImmunityModifier(DamageImmunityMod, fromAccount);


                Assert.IsTrue(activeGame.GlobalEnvironmentModifiers.ContainsValue(DamageImmunityMod), "Global Environment Mods List does not contain expected modifier");
                Assert.IsTrue(!activeGame.GlobalHeroModifers.ContainsValue(DamageImmunityMod), "Global Environment Mods List incorrectly contains expected modifier");
                Assert.IsTrue(!activeGame.GlobalVillainModifiers.ContainsValue(DamageImmunityMod), "Global Environment Mods List incorrectly contains expected modifier");

                foreach (CharacterAccount characterAccount in activeGame.EnvCharacters)
                {
                    Assert.IsTrue(characterAccount.ImmunityModList.ContainsValue(DamageImmunityMod), $"{characterAccount} does not contain the expected modifier");
                }
            }
            catch (Exception e)
            {
                Assert.Fail("Test failed: " + e);
            }
        }
コード例 #20
0
        public void DamageGivenOneTimeModTest()
        {
            Setup.SetupTestInfrastructure();
            ActiveGame activeGame = GameContainer.ActiveGame;

            try
            {
                AmountModifier   damageGivenMod = new AmountModifier("Critical Multiplier", "Increase next damage by 1", ModifierTargets.Local, AmountModifierType.DamageGiven, 1, true);
                CharacterAccount fromAccount    = activeGame.AllTargets[43];
                CharacterAccount toAccount      = activeGame.AllTargets[87];
                GameContainer.AddDamageGivenModifier(damageGivenMod, fromAccount);

                GameContainer.DealDamage(fromAccount, toAccount, 4, DamageType.Melee);

                int expectedHealth = 10;
                int actualhealth   = toAccount.CurrentHealth;
                Assert.IsTrue(expectedHealth == actualhealth, $"{toAccount.Name} health doesn't match expected health. Expected {expectedHealth}, actually {actualhealth}");

                int expectedMod = 0;
                int actualMod   = fromAccount.DamageGivenMod;
                Assert.IsTrue(expectedMod == actualMod, $"{fromAccount.Name} damage given mod doesn't match expected mod. Expected {expectedMod}, actually {actualMod}");
            }
            catch (Exception e)
            {
                Assert.Fail("Test failed: " + e);
            }
        }
コード例 #21
0
 public SpriteBatch(GameContainer container)
 {
     Container        = container;
     RenderParameters = new LinkedList <SpriteRenderParameter>();
     //Batch = new D2D1SpriteBatch(Container.DeviceContext);
     //Batch.
 }
コード例 #22
0
ファイル: EnemyInformation.cs プロジェクト: himeiyuna/Raysist
 /// <summary>
 /// @brief コンストラクタ
 /// </summary>
 /// <param name="container">自身を組み込むコンテナ</param>
 public EnemyInformation(GameContainer container, int life, ScoreComponent sc)
     : base(container)
 {
     Life = life;
     Count = 15;
     Speed = 5.0f;
     SC = sc;
 }
コード例 #23
0
 /// <summary>
 /// @brief コンストラクタ
 /// </summary>
 /// <param name="container"></param>
 /// <param name="to"></param>
 /// <param name="from"></param>
 /// <param name="time"></param>
 public InfrontAppearEnemy(GameContainer container, Vector3 to, Vector3 from)
     : base(container)
 {
     Position.LocalPosition = from;
     From = from;
     To = to;
     Diff = to - from;
 }
コード例 #24
0
ファイル: Positioner.cs プロジェクト: himeiyuna/Raysist
 /// <summary>
 /// @brief コンストラクタ
 /// </summary>
 public Positioner(GameContainer container)
 {
     Container = container;
     Children = new List<Positioner>();
     LocalPosition = new Vector3();
     LocalScale    = new Vector3 { x = 1.0f, y = 1.0f, z = 1.0f };
     LocalRotation = Quaternion.Identity;
 }
コード例 #25
0
ファイル: FanShot.cs プロジェクト: himeiyuna/Raysist
        /// <summary>
        /// @brief コンストラクタ
        /// </summary>
        public FanShot(GameContainer container, float angle, Vector3 pos, Player p)
            : base(container, angle, pos, p)
        {
            Angle = angle;

            Magazine = 9;
            Theta = Angle / Magazine;
        }
コード例 #26
0
ファイル: Program.cs プロジェクト: binlee1990/mini2Dx
        static void Main()
        {
            bool UAT_APP = true;

            GameContainer game = (UAT_APP ? new UATApplication() as GameContainer : new MonoGameUAT());

            using (var mini2DxGame = new Mini2DxGame(game))
                mini2DxGame.Run();
        }
コード例 #27
0
        private void RemoveGlobalMod_ButtonClick(object sender, RoutedEventArgs e)
        {
            if (lbGlobalModList.Items.Count > 0)
            {
                Modifier modifier = (Modifier)lbGlobalModList.SelectedItem;

                GameContainer.RemoveGlobalModifier(modifier);
            }
        }
コード例 #28
0
ファイル: ContainerFactory.cs プロジェクト: himeiyuna/Raysist
 /// <summary>
 /// @brief コンテナを生成する
 /// </summary>
 /// <returns>生成されたコンテナ</returns>
 public virtual GameContainer Create()
 {
     var ret = new GameContainer();
     if (Option != null)
     {
         Option(ret);
     }
     return ret;
 }
コード例 #29
0
        /// <summary>
        /// @brief コンストラクタ
        /// </summary>
        /// <param name="container">自身を組み込むコンテナ</param>
        /// <param name="to">目的地</param>
        public BehindAppearEnemy(GameContainer container, Vector3 from, Vector3 to)
            : base(container)
        {
            From = from;
            To = to;
            Diff = to - from;

            Position.LocalPosition = from;
        }
コード例 #30
0
 public GamePhase(GameContainer container) : base(PhaseType.InGame, null)
 {
     cam = new Camera(container.GraphicsDevice.Viewport);
     w   = new MyWorld(cam);
     w.Load(@".\Content\Level\Maps\smallRoom.xml", container.GraphicsDevice);
     cam.Follow  = w.npcs[0];
     followedNPC = 0;
     debug       = false;
 }
コード例 #31
0
        public MouseCursorTestOverlay(MouseInputService windowInputService, GameContainer container)
        {
            Container         = container;
            MouseInputService = windowInputService;
            MouseInputService.IsRendertimeUpdate = true;

            Resource.AddResource("ForegroundBrush", new SolidColorBrushResource(new RawColor4(1, 1, 1, .9f)));
            format = new TextFormat(Container.DWFactory, "MS Gothic", FontWeight.Bold, FontStyle.Normal, 32);
        }
コード例 #32
0
    GameChoiseResult GetNewStep(GameContainer game)
    {
        var step = new GameChoiseResult();

        step.roundNumber     = game.Number;
        step.opponentGesture = game.OpponentGesture;
        step.playerGesture   = game.MeGesture;
        step.result          = game.Result;
        return(step);
    }
コード例 #33
0
        public DebugOverlay(GameContainer container, MouseInputService mouseInputService)
        {
            Container         = container;
            MouseInputService = mouseInputService;

            Resource.AddResource("ForegroundBrush", new SolidColorBrushResource(new RawColor4(1, 1, 1, .9f)));
            format = new TextFormat(Container.DWFactory, "Consolas", FontWeight.Normal, FontStyle.Normal, 16);

            UpdateTimeQueue.Enqueue(0);            //dummy
        }
コード例 #34
0
ファイル: Game1.cs プロジェクト: mildmelon/mini2Dx
 public Game1()
 {
     IsFixedTimeStep = false;
     graphics        = new GraphicsDeviceManager(this);
     graphics.PreparingDeviceSettings += (object s, PreparingDeviceSettingsEventArgs args) =>
     {
         args.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents;
     };
     Content.RootDirectory = "Content";
     game = new MonoGameUAT();
 }
コード例 #35
0
 public FadeTransitionScene(LoadingOverlay overlay, GameContainer container, TimeSpan fadeTime)
 {
     Container       = container;
     Overlay         = overlay;
     FadingAnimation = new Animation(container);
     FadeTime        = fadeTime;
     parameter       = new LayerParameters()
     {
         ContentBounds = RectangleF.Infinite,
     };
 }
コード例 #36
0
        public KeyboardInputService(GameContainer container)
        {
            directInput = new DirectInput();

            //キーボード
            if (directInput.GetDevices(DeviceType.Keyboard, DeviceEnumerationFlags.AllDevices).Any())
            {
                keyboardDevice = new Keyboard(directInput);
                keyboardDevice.Acquire();
            }
        }
コード例 #37
0
ファイル: Program.cs プロジェクト: ingen084/Ingen.Game
            public SampleScene2(GameContainer container, FadeTransitionScene tscene)
            {
                Container       = container;
                TransitionScene = tscene;

                lastTime = DateTime.Now;
                position = 10;
                Resource.AddSolidColorBrushResource("MainBrush", new RawColor4(1, 1, 1, 1));
                Resource.AddPngImageResource("Image", Container.ImagingFactory, @"D:\ingen\Desktop\saikoro_145.png");

                System.Threading.Thread.Sleep(1000);
            }
コード例 #38
0
ファイル: Barrage.cs プロジェクト: himeiyuna/Raysist
 /// <summary>
 /// @brief コンストラクタ
 /// </summary>
 public Barrage(GameContainer container, float angle, Vector3 pos, Player p)
     : base(container)
 {
     Position.LocalPosition = pos;
     Angle = angle;
     Speed = 5.0f;
     Magazine = 36;
     Count = 10;
     SpaceanInterval = Count;//360/Magazine 弾の間隔;
     AimFlag = false;
     PlayerPosition = p;
 }
コード例 #39
0
ファイル: GameScene.cs プロジェクト: himeiyuna/Raysist
        public override void EnterScene()
        {
            var cf = new ContainerFactory((GameContainer g) =>
            {
                g.AddComponent(new Player(g));
                g.AddComponent(new DisablePlayer(g));
                g.AddComponent(new MeshRenderer(g, "fighter.x"));
                var col = new RectCollider(g, (Collider c) => { return; });
                col.Width = 10.0f;
                col.Height = 10.0f;
                g.AddComponent(col);
            });

            var cameraFactory = new ContainerFactory((GameContainer g) =>
            {
                g.AddComponent(new Camera(g));

            });

            var gc = cf.Create();
            Player player = gc.GetComponent<Player>();

            var fact = new ContainerFactory((GameContainer g) =>
            {
                var a = new RectCollider(g, (Collider c) => { DX.DrawString(0, 0, "HIT", DX.GetColor(255, 255, 255)); });
                a.Width = 10.0f;
                a.Height = 10.0f;
                g.AddComponent(a);
                g.Position.LocalPosition = new Vector3 { x = 50.0f, y = 50.0f, z = 0.0f };
            });
            fact.Create();

            var ec = new GameContainer();
            ec.AddComponent(new EnemyController(ec, player, new ScoreComponent(ec)));

            var camera = cameraFactory.Create().GetComponent<Camera>();
            camera.Position.LocalPosition = new Vector3 { x = 0.0f, y = 0.0f, z = -1000.0f };
            camera.FieldOfView = (float)Math.PI * 0.1f;

            var explosion = new GameContainer();
            explosion.Name = "Explosion";

            var sf = new ContainerFactory((GameContainer g) =>
            {
                var gcom = new Stage(g);
                g.AddComponent(gcom);
                g.AddComponent(new StageTimeline(g, gcom));
                g.AddComponent(new MeshRenderer(g, "hogeStage.x"));
                g.AddComponent(new MusicPlayer(g, "The Ray of Hopes (ver. seeing true sky).wav"));
            });

            sf.Create();
        }
コード例 #40
0
ファイル: Program.cs プロジェクト: samuelgecik/OOP
        static void Main(string[] args)
        {
            GameContainer container = new GameContainer("window", 650, 400); //constructor, creates new instance of the game
            Gravity       gravity   = new Gravity();

            container.GetWorld().SetPhysics(gravity);

            Kettle kettle = new Kettle();

            container.GetWorld().AddActor(kettle);
            kettle.SetPosition(100, 100);

            Stove stove = new Stove();

            container.GetWorld().AddActor(stove);
            stove.SetPosition(170, 170);
            stove.AddKettle(kettle);

            PowerSource source = new PowerSource();

            container.GetWorld().AddActor(source);
            source.SetPosition(200, 200);

            Crystal crystal = new Crystal(source);

            container.GetWorld().AddActor(crystal);
            crystal.SetPosition(200, 250);

            CrackedCrystal crackedCrystal = new CrackedCrystal(source, 3);

            container.GetWorld().AddActor(crackedCrystal);
            crackedCrystal.SetPosition(200, 350);

            Player player = new Player();

            container.GetWorld().AddActor(player);
            player.SetPhysics(true);
            player.SetPosition(220, 100);

            Enemy enemy = new Enemy(player, 5, 20, 20);

            container.GetWorld().AddActor(enemy);
            enemy.SetPhysics(true);
            enemy.SetPosition(300, 100);

            container.SetMap("resources/maps/map01.tmx");

            stove.AddKettle(kettle);



            container.Run(); //start the game, infinite loop, no change is accepted after this until the game ends
        }
コード例 #41
0
        public void TestCreateWorld()
        {
            // create dir if it doesn't already exist, for testing with json
            Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\.textadventure\Logs\");

            var entireWorld = new GameContainer();

            entireWorld.Name = "Entire World";

            var bedroom = new GameLocation("Bedroom");

            bedroom.Description = "An untidy bedroom";
            entireWorld.AddRelationship(RelationshipType.Contains, RelationshipDirection.ParentToChild, bedroom);

            var mainCharacter = new GameCharacter("Alfie Drever");

            mainCharacter.Description = "Lazy but deeply lovable";
            mainCharacter.Gender      = "Male";
            bedroom.AddRelationship(RelationshipType.Contains, RelationshipDirection.ParentToChild, mainCharacter);

            var bed = new GameObject("Bed");

            bedroom.AddRelationship(RelationshipType.Contains, RelationshipDirection.ParentToChild, bed);

            var wallet = new GameObject("Wallet");

            wallet.IsOpenable = true;
            wallet.AddRelationship(RelationshipType.IsUnder, RelationshipDirection.ChildToParent, bed);

            var money = new GameCurrencyObject("Money", 10);

            wallet.AddRelationship(RelationshipType.Contains, RelationshipDirection.ParentToChild, money);

            var bedroomDoor = new GameObject("Bedroom Door");

            bedroom.AddRelationship(RelationshipType.Contains, RelationshipDirection.ParentToChild, bedroomDoor);

            var landing = new GameLocation("The landing");

            landing.Description = "Area of carpeted land outside bedroom door";
            bedroomDoor.AddRelationship(RelationshipType.LeadsTo, RelationshipDirection.ParentToChild, landing);

            var parser = new Parser(new CommandCoordinator(new CommandExecutor(), new ObjectRepository()));

            var lo = new LocationRepository();

            lo.SaveCurrentLocation(mainCharacter, bedroom);

            var takestatus = parser.ParseInput(mainCharacter.ID, "take Wallet");

            Assert.AreEqual(takestatus, "Alfie Drever took Wallet");
        }
コード例 #42
0
        public void UpdateDevice(GameContainer container)
        {
            if (BaseImage != null)
            {
                BaseImage.UpdateDevice(container);
                var size = BaseImage.Image.PixelSize;
                Rect = new RawRectangleF(0, 0, size.Width, size.Height);
                return;
            }

            CropEffect?.Dispose();
            CropEffect = new Crop(container.DeviceContext);
        }
コード例 #43
0
    void ExpectingMove(MatchContainer match, GameContainer game)
    {
        if (!match.Tournament.Equals(TournamentManager.Instance.CurrentTournament.Id))
        {
            return;
        }

        nextTimeout = game.NextTimeout.Value.AddSeconds(-2);
        if (gameObject.activeInHierarchy)
        {
            StartCoroutine(NewGameStart());
        }
    }
コード例 #44
0
ファイル: Player.cs プロジェクト: himeiyuna/Raysist
        //ここまで
        //----------------------------------------------------
        /// <summary>
        /// @brief コンストラクタ
        /// </summary>
        public Player(GameContainer container)
            : base(container)
        {
            Speed = 5.0f;
            Position.LocalRotation = new Quaternion(Vector3.AxisX, -(float)Math.PI * 0.5f) * new Quaternion(Vector3.AxisY, (float)Math.PI);
            Position.LocalPosition = new Vector3 { x = 100.0f, y = 0.0f, z = 0.0f };
            Rot = 0;

            var bitmaker = new BitFactory(this, Bit.BitIndex.BIT_LEFT);
            var bitmaker2 = new BitFactory(this, Bit.BitIndex.BIT_RIGHT);

            bitmaker.Create();
            bitmaker2.Create();
        }
コード例 #45
0
ファイル: Program.cs プロジェクト: sifudiep/consoleThree
        public static void Main(string[] args)
        {
            var gc         = new GameContainer();
            var mapCreator = new MapCreator();

            // Startar map settings vilket skapar väggar.
            mapCreator.MapSettings();

            // Loopar HandleInput för att konstant kolla om spelaren klickat på knappar
            while (true)
            {
                gc.HandleInput();
            }
        }
コード例 #46
0
 //Must call when load 1st scence
 public bool InitDatabase()
 {
     if (Directory.Exists(DataConstant.databasePath))
     {
         this.container = LoadGame();
         Debug.Log(this.container);
     }
     else
     {
         Directory.CreateDirectory(DataConstant.databasePath);
         SaveGame();
     }
     return(true);
 }
コード例 #47
0
ファイル: Score.cs プロジェクト: himeiyuna/Raysist
        /// <summary>
        /// @brief コンストラクタ
        /// </summary>
        /// <param name="container">自身を組み込むコンテナ</param>
        public ScoreComponent(GameContainer container)
            : base(container)
        {
            Scores = new Number[10];

            for (var i = 0; i < Scores.Length; ++i)
            {
                var gc = new GameContainer(container);
                Scores[i] = new Number(gc);
                gc.AddComponent(Scores[i]);
                gc.Position.LocalPosition = new Vector3 { x = i * 32.0f, y = 0.0f, z = 0.0f };
            }

            Score = 0;
        }
コード例 #48
0
ファイル: Camera.cs プロジェクト: Gkowloon/Raysist
        /// <summary>
        /// @brief コンストラクタ
        /// </summary>
        /// <param name="container">コンポーネントを実装するコンテナ</param>
        public Camera(GameContainer container)
            : base(container)
        {
            Position.LocalPosition.z = -100.0f;
            Near = DefaultNear;
            Far  = DefaultFar;

            // 初期値はウィンドウの幅と高さに設定
            int width, height;
            DX.GetWindowSize(out width, out height);
            ScreenWidth  = (float)width;
            ScreenHeight = (float)height;

            FieldOfView = DefaultFOV;
        }
コード例 #49
0
ファイル: StayEnemy.cs プロジェクト: himeiyuna/Raysist
 /// <summary>
 /// @brief コンストラクタ
 /// </summary>
 /// <param name="time">滞在期間</param>
 public StayEnemy(GameContainer container, int time)
     : base(container, false)
 {
     StayTime = time;
 }
コード例 #50
0
ファイル: Player.cs プロジェクト: Gkowloon/Raysist
 /// <summary>
 /// @brief コンストラクタ
 /// </summary>
 public Player(GameContainer container)
     : base(container)
 {
     Position.LocalRotation *= new Quaternion(Vector3.AxisY, (float)Math.PI);
 }
コード例 #51
0
ファイル: Player.cs プロジェクト: Gkowloon/Raysist
 public Bit(GameContainer container)
     : base(container)
 {
     Position.LocalPosition = new Vector3 { x = 40.0f, y = 0.0f, z = -40.0f };
 }
コード例 #52
0
ファイル: ContainerFactory.cs プロジェクト: Gkowloon/Raysist
 /// <summary>
 /// @brief 親が設定されたコンテナを生成する
 /// </summary>
 /// <param name="parent">親</param>
 /// <returns>生成されたコンテナ</returns>
 public virtual GameContainer Create(GameContainer parent)
 {
     var ret = new GameContainer(parent);
     CreateFunction(ret);
     return ret;
 }
コード例 #53
0
ファイル: CircleShot.cs プロジェクト: himeiyuna/Raysist
 /// <summary>
 /// @brief コンストラクタ
 /// </summary>
 public CircleShot(GameContainer container, float angle, Vector3 pos, Player p)
     : base(container, angle, pos, p)
 {
     Magazine = 18;
     space = (float)Math.PI / Magazine;
 }
コード例 #54
0
ファイル: Form1.cs プロジェクト: Quacky2200/MiniGameEngine
 private void Form1_Load(object sender, EventArgs e)
 {
     GameContainer gc = new GameContainer(this);
     gc.Start();
 }
コード例 #55
0
ファイル: EnemyController.cs プロジェクト: himeiyuna/Raysist
 public EnemyController(GameContainer container, Player p, ScoreComponent sc)
     : base(container, "enemy.csv")
 {
     PlayerPosition = p;
     SC = sc;
 }
コード例 #56
0
ファイル: MusicPlayer.cs プロジェクト: himeiyuna/Raysist
 /// <summary>
 /// @brief コンストラクタ
 /// </summary>
 /// <param name="container">自身を組み込むコンテナ</param>
 /// <param name="path">ファイルパス</param>
 public MusicPlayer(GameContainer container, string path)
     : base(container)
 {
     MusicHandle = ResourceController.Instance.LoadMusic(path);
     DX.PlayMusicMem(MusicHandle, 2);
 }
コード例 #57
0
ファイル: AppearedEnemy.cs プロジェクト: himeiyuna/Raysist
 public AppearedEnemy(GameContainer container)
     : base(container)
 {
 }
コード例 #58
0
ファイル: SpriteRenderer.cs プロジェクト: himeiyuna/Raysist
 /// <summary>
 /// @brief コンストラクタ
 /// </summary>
 /// <param name="container">コンテナ</param>
 /// <param name="path">ファイルの場所</param>
 public SpriteRenderer(GameContainer container, string path)
     : this(container)
 {
     GraphicHandle = ResourceController.Instance.LoadGraphic(path);
 }
コード例 #59
0
    private void SetGameInternal(GameType type, bool hasEnvironment)
    {
        var TextureContainer = new TextureContainer ();
        var BallFactory = new BallFactory (TextureContainer);
        var BallManager = new BallManager (BallFactory);
        var GameCore = new GameCore (BallManager);
        var EventFactory = new EventFactory (GameCore);
        var GameController = MakeController (type, GameCore, EventFactory);
        var Environment = new Environment (GameController, EventFactory);

        _container = new GameContainer (GameCore, GameController, Environment, hasEnvironment);
        HasErrors = false;
        Initialized = true;
    }
コード例 #60
0
ファイル: Renderer.cs プロジェクト: Gkowloon/Raysist
 public Renderer(GameContainer container)
     : base(container)
 {
 }