/// <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; }
private void DealDamage(int amount, CharacterAccount to) { CharacterAccount from = selectedCharacter; DamageType dmgType = (DamageType)cbDamageTypeList.SelectedItem; GameContainer.DealDamage(from, to, amount, dmgType); }
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); } }
//ここまで //---------------------------------------------------- /// <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); } }
//ここまで //---------------------------------------------------- /// <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; }
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); } }
/// <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; }
/// <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"; } }
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; } }
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 }
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); } }
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(); } }
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); } }
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); } }
/// <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(); }
public MouseInputService(GameContainer container) { Container = container; directInput = new DirectInput(); device = new Mouse(directInput); device.Acquire(); }
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))); }
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); } }
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); } }
public SpriteBatch(GameContainer container) { Container = container; RenderParameters = new LinkedList <SpriteRenderParameter>(); //Batch = new D2D1SpriteBatch(Container.DeviceContext); //Batch. }
/// <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; }
/// <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; }
/// <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; }
/// <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; }
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(); }
private void RemoveGlobalMod_ButtonClick(object sender, RoutedEventArgs e) { if (lbGlobalModList.Items.Count > 0) { Modifier modifier = (Modifier)lbGlobalModList.SelectedItem; GameContainer.RemoveGlobalModifier(modifier); } }
/// <summary> /// @brief コンテナを生成する /// </summary> /// <returns>生成されたコンテナ</returns> public virtual GameContainer Create() { var ret = new GameContainer(); if (Option != null) { Option(ret); } return ret; }
/// <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; }
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; }
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); }
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); }
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 }
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(); }
public FadeTransitionScene(LoadingOverlay overlay, GameContainer container, TimeSpan fadeTime) { Container = container; Overlay = overlay; FadingAnimation = new Animation(container); FadeTime = fadeTime; parameter = new LayerParameters() { ContentBounds = RectangleF.Infinite, }; }
public KeyboardInputService(GameContainer container) { directInput = new DirectInput(); //キーボード if (directInput.GetDevices(DeviceType.Keyboard, DeviceEnumerationFlags.AllDevices).Any()) { keyboardDevice = new Keyboard(directInput); keyboardDevice.Acquire(); } }
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); }
/// <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; }
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(); }
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 }
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"); }
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); }
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()); } }
//ここまで //---------------------------------------------------- /// <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(); }
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(); } }
//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); }
/// <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; }
/// <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; }
/// <summary> /// @brief コンストラクタ /// </summary> /// <param name="time">滞在期間</param> public StayEnemy(GameContainer container, int time) : base(container, false) { StayTime = time; }
/// <summary> /// @brief コンストラクタ /// </summary> public Player(GameContainer container) : base(container) { Position.LocalRotation *= new Quaternion(Vector3.AxisY, (float)Math.PI); }
public Bit(GameContainer container) : base(container) { Position.LocalPosition = new Vector3 { x = 40.0f, y = 0.0f, z = -40.0f }; }
/// <summary> /// @brief 親が設定されたコンテナを生成する /// </summary> /// <param name="parent">親</param> /// <returns>生成されたコンテナ</returns> public virtual GameContainer Create(GameContainer parent) { var ret = new GameContainer(parent); CreateFunction(ret); return ret; }
/// <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; }
private void Form1_Load(object sender, EventArgs e) { GameContainer gc = new GameContainer(this); gc.Start(); }
public EnemyController(GameContainer container, Player p, ScoreComponent sc) : base(container, "enemy.csv") { PlayerPosition = p; SC = sc; }
/// <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); }
public AppearedEnemy(GameContainer container) : base(container) { }
/// <summary> /// @brief コンストラクタ /// </summary> /// <param name="container">コンテナ</param> /// <param name="path">ファイルの場所</param> public SpriteRenderer(GameContainer container, string path) : this(container) { GraphicHandle = ResourceController.Instance.LoadGraphic(path); }
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; }
public Renderer(GameContainer container) : base(container) { }