Пример #1
0
        public static BaseGameObject makeDoor( string doorType, string name, int ownerID, Vector2 position, 
            string nextMap, bool isOpen = false,
            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().DoorDefinitionList.getObject( doorType );

            // 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, 1,
                tempAnimationDefenition.NumberOfFrames, isOpen, name, position, tempWidth, tempHeight,
                GameData.getInstance().ArtManager.getObject( tempAnimationDefenition.TextureName), false, false, 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;
        }
Пример #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;
        }
Пример #3
0
        public static BaseGameObject makePlayer( string animationType, string name, int ownerID, Vector2 position, 
            Buttons mainMovmentStick = Buttons.LeftStick, float walkingSpeed = 0.0f, float runningSpeed = 0.0f, bool isRunning = false,
            bool glow = false, Nullable<Color> tint = null, float rotation = 0.0f, Nullable<Vector2> origin = null,
            float scale = 1.0f, SpriteEffects spriteEffect = SpriteEffects.None, float layer = 1.0f)
        {
            // Start makeStaticAnimation.

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

            // Grabbing the animation definition from the list:
            SpriteDefenition tempSpriteDefenition = GameData.getInstance().SpriteDefinitionList.getObject( animationType );

            // caching the width and height based on the default action:
            tempWidth = tempSpriteDefenition.DefaultDrawWidth;
            tempHeight = tempSpriteDefenition.DefaultDrawHeight;

            // 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,
            //    Game1.Instance.ArtManager.getObject(tempAnimationDefenition.TextureName), isRunning, continuous, glow, tint, rotation, origin,
            //    scale, spriteEffect, layer
            //    );

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

            // Creating the mover:
            PlayerMovableViaStick playerMover = new PlayerMovableViaStick( ownerID );

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

            return tempAnimationObject;
        }