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 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(); }
/// <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; }
public override GameContainer Create() { var gc = new GameContainer(); gc.AddComponent(new EnemyInformation(gc, BehindAppearEnemy.MaxLife, SC)); gc.AddComponent(new BehindAppearEnemy(gc, From, To)); var re = new RetreatEnemy(gc, Speed); re.Active = false; gc.AddComponent(re); var rc = new RectCollider(gc, (Collider c) => { DX.DrawString(0, 150, "Enemy Hit", DX.GetColor(255, 255, 255)); }); rc.Active = false; rc.Width = 50.0f; rc.Height = 50.0f; gc.AddComponent(rc); gc.AddComponent(new MeshRenderer(gc, "fighter.x")); gc.Position.LocalRotation = new Quaternion(Vector3.AxisX, (float)Math.PI * 0.5f); //var vs = new FanShot(gc, (float)Math.PI * 0.5f, From, PlayerPosition); //vs.Magazine = 7; //var vs = new VerticalShot(gc, 0.5f, From, PlayerPosition); var vs = new CircleShot(gc, 0.5f, From, PlayerPosition); vs.Magazine = 36; vs.Speed = 5.0f; vs.Count = 60; vs.SpaceanInterval = 60; vs.AimFlag = false; gc.AddComponent(vs); return gc; }
/// <summary> /// @brief コンストラクタ /// </summary> public override void Update() { --Count; if (Count < 0) { Count = 15; } if (Position.LocalPosition.x < -1600 || Position.LocalPosition.x > 1600 || Position.LocalPosition.y < -1600 || Position.LocalPosition.y > 1600) { // TODO:外に出たら破棄する GameContainer.Destroy(Container); } if (Life <= 0) { GameContainer.Destroy(Container); var gc = new GameContainer(Game.Instance.SceneController.CurrentScene.Root.Position.FindChild("Explosion").Container); gc.Position.LocalPosition = Position.LocalPosition; var spriteRenderer = new BillboardRenderer(gc); spriteRenderer.Scale = 64.0f; var animator = new Animator(gc, spriteRenderer, "explosion.png", 4, 4, 1, 512, 512, true); animator.UpdateFrame = 3; gc.AddComponent(spriteRenderer); gc.AddComponent(animator); SC.Score += 100; animator.OnFinishAnimation = (Animator a) => { GameContainer.Destroy(a.Container); }; } }
public override GameContainer Create() { var gc = new GameContainer(); var iae = new InfrontAppearEnemy(gc, To, new Vector3 { x = To.x + 500.0f * (Dir == Direction.LEFT ? -1 : 1), y = 500.0f, z = 0.0f }); var se = new StayEnemy(gc, StayTime); var de = new DisappearEnemy(gc, new Vector3 { x = To.x + 500.0f * (Dir == Direction.LEFT ? 1 : -1), y = 500.0f, z = 0.0f }, 0.3f); gc.AddComponent(iae); gc.AddComponent(se); gc.AddComponent(de); gc.AddComponent(new EnemyInformation(gc, BehindAppearEnemy.MaxLife, SC)); gc.AddComponent(new MeshRenderer(gc, "fighter.x")); var col = new RectCollider(gc, (Collider c) => { }); col.Width = 50.0f; col.Height = 50.0f; gc.AddComponent(col); var vs = new FanShot(gc, (float)Math.PI * 0.5f, To, PlayerPosition); vs.Magazine = 7; //var vs = new VerticalShot(gc, 0.5f, From, PlayerPosition); //var vs = new CircleShot(gc, 0.5f, From, PlayerPosition); //vs.Magazine = 36; vs.Speed = 5.0f; vs.Count = 60; vs.SpaceanInterval = 60; vs.AimFlag = false; gc.Position.LocalRotation = new Quaternion(Vector3.AxisX, (float)Math.PI * 0.5f); gc.AddComponent(vs); return gc; }
/// <summary> /// @brief コンテナ生成関数 /// </summary> /// <returns></returns> public override GameContainer Create() { var g = new GameContainer(Player.Container); var raypierEnd = new GameContainer(); raypierEnd.Active = false; var raypier = new GameContainer(); var bit = new Bit(g, Player, Index, raypier); g.AddComponent(bit); var r = new Raypier(raypier, raypierEnd, bit); r.Active = false; raypier.AddComponent(r); g.AddComponent(new MeshRenderer(g, "bit.x")); g.Position.LocalRotation *= new Quaternion(Vector3.AxisX, -(float)Math.PI * 0.5f); g.Position.LocalScale *= 3.0f; raypierEnd.AddComponent(new RaypierRenderFinisher(raypierEnd)); return g; }