예제 #1
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;
        }
예제 #2
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;
        }