コード例 #1
0
ファイル: Tilemap.cs プロジェクト: HaKDMoDz/EntityEngineV4
 public Tilemap(Node parent, string name, Texture2D tileTexture, Point size, Point tileSize)
     : base(parent, name)
 {
     Body = new Body(this, "Body");
     Render = new TilemapRender(this, "TilemapRender", tileTexture, size, tileSize);
     Render.LinkDependency(TilemapRender.DEPENDENCY_BODY, Body);
 }
コード例 #2
0
 public CameraNode(State stateref, string name)
     : base(stateref, name)
 {
     Body = new Body(this, "Body", new Vector2(EntityGame.Viewport.Width / 2f, EntityGame.Viewport.Height / 2f));
     Image = new ImageRender(this, "Image", Assets.Pixel);
     Image.LinkDependency(ImageRender.DEPENDENCY_BODY, Body);
     Image.Scale = new Vector2(50, 100);
     Image.Color = Color.Red;
 }
コード例 #3
0
        public BaseNode(Node parent, string name)
            : base(parent, name)
        {
            Body = new Body(this, "Body");

            Physics = new Physics(this, "Physics");
            Physics.LinkDependency(Physics.DEPENDENCY_BODY, Body);

            Collision = new Collision(this, "Collision");
            Collision.LinkDependency(Collision.DEPENDENCY_PHYSICS, Physics);
        }
コード例 #4
0
 public AnimationTestNode(State stateref, string name)
     : base(stateref, name)
 {
     Body = new Body(this, "Body");
     Body.Position = new Vector2(100, 400);
     StandingAnim = new SourceAnimation(this, "StandingAnim", EntityGame.Self.Content.Load<Texture2D>(@"SourceAnimationTest/scott"), new Vector2(36, 59), 8);
     StandingAnim.LinkDependency(SourceAnimation.DEPENDENCY_BODY, Body);
     StandingAnim.Scale = Vector2.One;
     StandingAnim.ReadXml(@"States\SourceRectangleTest\standing.xml");
     StandingAnim.Start();
     StandingAnim.Debug = true;
 }
コード例 #5
0
ファイル: SimpleBar.cs プロジェクト: HaKDMoDz/EntityEngineV4
        public SimpleBar(Node parent, string name, Body body)
            : base(parent, name)
        {
            _bgBarBody = body;
            _fgBarBody = new Body(this, "FGBarBody");

            _fgBarBody.X = body.X;
            _fgBarBody.Y = body.Y;
            _fgBarBody.Height = body.Height;
            _fgBarBody.Width = body.Width;

            _fgBar = new ShapeTypes.Rectangle(this, "FGBar", true);
            _fgBar.LinkDependency(ShapeTypes.Rectangle.DEPENDENCY_BODY, _fgBarBody);

            _bgBar = new ShapeTypes.Rectangle(this, "BGBar", true);
            _bgBar.LinkDependency(ShapeTypes.Rectangle.DEPENDENCY_BODY, _bgBarBody);
        }
コード例 #6
0
            public ParticleNode(Node parent, string name)
                : base(parent, name)
            {
                Body = new Body(this, "Body");
                Body.Width = 10;
                Body.Height = 10;
                Body.Y = OffsetY;

                Physics = new Physics(this, "Physics");
                Physics.LinkDependency(Physics.DEPENDENCY_BODY, Body);

                Render = new ShapeTypes.Rectangle(this, "Render", true);
                Render.LinkDependency(ShapeTypes.Rectangle.DEPENDENCY_BODY, Body);
                Render.Color = Color.OrangeRed;

                _emitter = new ParticleEmitter(this, "Emitter");
                _emitter.LinkDependency(ParticleEmitter.DEPENDENCY_BODY, Body);
            }
コード例 #7
0
ファイル: Control.cs プロジェクト: HaKDMoDz/EntityEngineV4
        protected Control(Node parent, string name)
            : base(parent, name)
        {
            Visible = true;
            Body = new Body(this, "Body");

            //Add our service if we have a parent, if not, we will let them update and draw
            if (parent != null && parent.GetType() != typeof (ControlHandler))
            {
                ControlHandler = GetRoot<State>().GetService<ControlHandler>();
                if (ControlHandler == null)
                {
                    EntityGame.Log.Write("ControlHandler was not found! Cannot attach to Service", this, Alert.Error);
                    //throw new Exception("ControlHandler was not found!");
                }
            }
            else if (parent != null && parent.GetType() == typeof(ControlHandler))
            {
                ControlHandler = parent as ControlHandler;
            }
        }
コード例 #8
0
ファイル: TextButton.cs プロジェクト: HaKDMoDz/EntityEngineV4
        public TextButton(Node parent, string name, Vector2 position, RGBColor color)
            : base(parent, name)
        {
            Body.Position = position;

            _textBody = new Body(this, "TextBody");
            TextRender = new TextRender(this, "Render", Assets.Font, "");
            TextRender.LinkDependency(TextRender.DEPENDENCY_BODY, _textBody);
            TextRender.Layer = .9f;

            //Start setting up Render's body
            _textBody.Bounds = TextRender.Bounds;
            Body.Bounds = TextRender.Bounds + Spacing;

            _textBody.Position = new Vector2(Body.Position.X + Body.Bounds.X / 2 - _textBody.Bounds.X / 2,
                Body.Position.Y + Body.Bounds.Y / 2 - _textBody.Bounds.Y / 2);

            //Make our rectangles
            _bodyImage = new ShapeTypes.Rectangle(this, "BodyImage", true);
            _bodyImage.LinkDependency(ShapeTypes.Rectangle.DEPENDENCY_BODY, Body);
            _bodyImage.Color = color;
        }
コード例 #9
0
            /// <summary>
            /// /Creates a new AABBEntity
            /// </summary>
            /// <param name="stateref"></param>
            /// <param name="name"></param>
            public CollisionTestNode(State stateref, string name)
                : base(stateref, name)
            {
                Body = new Body(this, "Body");

                Physics = new Physics(this, "Physics");
                Physics.LinkDependency(Physics.DEPENDENCY_BODY, Body);

                Collision = new Collision(this, "Collision");
                Collision.LinkDependency(Collision.DEPENDENCY_PHYSICS, Physics);

                ImageRender = new ImageRender(this, "Image", Assets.Pixel);
                ImageRender.LinkDependency(ImageRender.DEPENDENCY_BODY, Body);

                TextBody = new Body(this, "TextBody");

                TextRender = new TextRender(this, "Render");
                TextRender.LinkDependency(TextRender.DEPENDENCY_BODY, TextBody);
            }
コード例 #10
0
            public TestEntity(Node parent, string name)
                : base(parent, name)
            {
                Body = new Body(this, "Body");

                Physics = new Physics(this, "Physics");
                Physics.Mass = 10;
                Physics.LinkDependency(Physics.DEPENDENCY_BODY, Body);

                Collision = new Collision(this, "Collision");
                Collision.Group.AddMask(0);
                Collision.Pair.AddMask(0);
                Collision.ResolutionGroup.AddMask(0);
                Collision.LinkDependency(Collision.DEPENDENCY_PHYSICS, Physics);
            }
コード例 #11
0
ファイル: Camera.cs プロジェクト: HaKDMoDz/EntityEngineV4
 public void FollowPoint(Body b)
 {
     Target = b;
     FollowType = FollowStyle.LockOn;
 }
コード例 #12
0
            public ResolutionTestNode(State stateref, string name)
                : base(stateref, name)
            {
                Body = new Body(this, "Body");
                Body.Bounds = new Vector2(70, 70);

                _physics = new Physics(this, "_physics");
                _physics.LinkDependency(Physics.DEPENDENCY_BODY, Body);
                _physics.Mass = 10f;
                _physics.Restitution = 1f;
                _physics.Drag = .95f;

                Shape = new AABB(this, "AABB");
                Shape.LinkDependency(AABB.DEPENDENCY_BODY, Body);

                Collision = new Collision(this, "Collision");
                Collision.LinkDependency(Collision.DEPENDENCY_SHAPE, Shape);
                Collision.LinkDependency(Collision.DEPENDENCY_PHYSICS, _physics);
                Collision.Initialize();

                _imageRender = new ImageRender(this, "Image", Assets.Pixel);
                _imageRender.LinkDependency(ImageRender.DEPENDENCY_BODY, Body);
                _imageRender.Scale = new Vector2(70, 70);
                _imageRender.Layer = .5f;

                _textBody = new Body(this, "_textBody");

                _textRender = new TextRender(this, "_textRender");
                _textRender.LinkDependency(TextRender.DEPENDENCY_BODY, _textBody);
                _textRender.Color = Color.White;
                _textRender.Font = Assets.Font;
                _textRender.Text = Name;
                _textRender.Layer = 1f;
            }
コード例 #13
0
            public AsteroidGhost(Node parent, string name)
                : base(parent, name)
            {
                Body = new Body(this, "Body");

                Render = new ImageRender(this, "Render");
                Render.SetTexture(GetRoot<State>().GetService<AssetCollector>().GetAsset<Texture2D>("circle"));
                Render.LinkDependency(ImageRender.DEPENDENCY_BODY, Body);

                Collision = new Collision(this, "Collision");
                Collision.Pair.AddMask(0);
                Collision.Pair.AddMask(1);
                Collision.Pair.AddMask(2);
                Collision.Group.AddMask(3);
            }
コード例 #14
0
ファイル: Body.cs プロジェクト: HaKDMoDz/EntityEngineV4
 public Body Clone()
 {
     var b = new Body(Parent, Name);
     b.Position = Position;
     b.Angle = Angle;
     return b;
 }
コード例 #15
0
ファイル: Cursor.cs プロジェクト: HaKDMoDz/EntityEngineV4
        public Cursor(Node parent, string name)
            : base(parent, name)
        {
            Active = true;
            Visible = false;

            Body = new Body(this, "Body");
            Body.Position = new Vector2(400, 300);

            //Default rendering is a single white pixel.
            Render = new ImageRender(this, "ImageRender", Assets.Pixel);
            Render.LinkDependency(ImageRender.DEPENDENCY_BODY, Body);
            Render.Layer = 1f;
            Render.Scale = Vector2.One * 3f;
            Render.Color = Color.Black;

            Body.Bounds = Render.Scale;
        }
コード例 #16
0
            public PrimitiveTestNode(Node parent, string name)
                : base(parent, name)
            {
                Body = new Body(this, "Body");
                Physics = new Physics(this, "Physics");
                Physics.LinkDependency(Physics.DEPENDENCY_BODY, Body);

                Physics.AngularVelocity = .01f;
            }
コード例 #17
0
                public TrailParticle(Node parent, int ttl)
                    : base(parent, ttl)
                {
                    Body = new Body(this, "Body");
                    Body.Origin = new Vector2(.5f, .5f);

                    Physics = new Physics(this, "Physics");
                    Physics.LinkDependency(Physics.DEPENDENCY_BODY, Body);

                    Render = new ShapeTypes.Rectangle(this, "Render", true);
                    Render.LinkDependency(ShapeTypes.Rectangle.DEPENDENCY_BODY, Body);
                    Render.Color = Color.OrangeRed;

                    DeathTimer.LastEvent += () => Destroy();
                }
コード例 #18
0
            public ParticleTestManager(State stateref)
                : base(stateref, "ParticleTestManager")
            {
                _controlHandler = stateref.GetService<ControlHandler>();
                _body = new Body(this, "EmitterBody");
                Spawner = new TestSpawner(this, "Spawner");

                _moveCursor = new GamePadAnalog(this, "MoveCursor", Sticks.Left, PlayerIndex.One);
                _emitButton = new GamepadInput(this, "EmitButton", Buttons.B, PlayerIndex.One);
            }
コード例 #19
0
                    public TestSpawn(Node parent)
                        : base(parent, 2000)
                    {
                        Body = new Body(this, "Body");
                        Body.Origin = new Vector2(.5f, .5f);

                        Physics = new Physics(this, "Physics");
                        Physics.LinkDependency(Physics.DEPENDENCY_BODY, Body);

                        RectRender = new ShapeTypes.Rectangle(this, "RectRender", RandomHelper.RandomBool());
                        RectRender.LinkDependency(ShapeTypes.Rectangle.DEPENDENCY_BODY, Body);

                        RectRender.Thickness = 1;
                        Render = RectRender;
                        FadeAge = 1000;

                        DeathTimer.LastEvent += Recycle;
                    }