Example #1
0
        public void setUp( Vector2 position, int width, int height, ILogic brain = null, BodyBase body = null, IRenderable renderer = null, IMovable mover = null )
        {
            // Start setUp.

            if (!_setUp)
            { // Start not setup if.

                _position = position;
                _width = width;
                _height = height;

                _setUp = true;

                if (brain != null)
                    _brain = brain;

                if (body != null)
                    _body = body;

                if (renderer != null)
                    _renderer = renderer;

                if ( mover != null)
                    _mover = mover;

            } // End not setup if.
        }
Example #2
0
        public static BaseGameObject makeCollisionBox( string name, Vector2 position, int width, int height )
        {
            // Start makeCollisionBox.

            // Making temp variables to hold cached data:
            int tempOwnerID;

            // Creating the base object:
            BaseGameObject tempCollisionObject = new BaseGameObject();

            // Caching the owner ID:
            tempOwnerID = tempCollisionObject.ID;

            // Creating the Body:
            BodyBase bodyComponent = new BodyBase( tempOwnerID, width, height );

            // Setting up the base object with the components:
            tempCollisionObject.setUp(position, width, height, null, bodyComponent,
                                        null, null);

            return tempCollisionObject;
        }
Example #3
0
        public static BaseGameObject makeDynamicAnimation( string animationType, string name, int ownerID, Vector2 position, int playMax = 1,
            bool continuous = true, bool reverse = false,
            bool isRunning = true, bool glow = false, float layer = 1.0f, Nullable<Color> tint = null, float rotation = 0.0f, Nullable<Vector2> origin = null,
            float scale = 1.0f, SpriteEffects spriteEffect = SpriteEffects.None)
        {
            // Start makeStaticAnimation.

            // Making temp variables to hold cached data:
            int tempOwnerID;
            int tempWidth;
            int tempHeight;

            // Grabbing the animation definition from the list:
            AnimationDefenition tempAnimationDefenition = GameData.getInstance().AnimationDefinitionList.getObject( animationType );

            // caching the width and height:
            tempWidth = tempAnimationDefenition.Width;
            tempHeight = tempAnimationDefenition.Height;

            // Creating the base object:
            BaseGameObject tempAnimationObject = new BaseGameObject();

            // Caching the owner ID:
            tempOwnerID = tempAnimationObject.ID;

            // Creating the renderer:
            AnimationComponent tempAnimationComponent = new AnimationComponent(
                tempAnimationObject.ID, tempAnimationDefenition.StartX, tempAnimationDefenition.StartY, tempAnimationDefenition.PlayLength, playMax,
                tempAnimationDefenition.NumberOfFrames, reverse, name, position, tempWidth, tempHeight,
                GameData.getInstance().ArtManager.getObject(tempAnimationDefenition.TextureName), isRunning, continuous, glow, tint, rotation, origin,
                scale, spriteEffect, layer
                );

            // Creating the Body:
            BodyBase bodyComponent = new BodyBase( tempOwnerID, tempWidth, tempHeight );

            // Setting up the base object with the components:
            tempAnimationObject.setUp( position, tempWidth, tempHeight, null, bodyComponent,
                                        tempAnimationComponent, null );

            return tempAnimationObject;
        }