Esempio n. 1
0
        public void setUp( string spriteName, int numberOfDirections = 0, int numberOfActions = 0, bool isSavable = false, string SavePathAndName = null)
        {
            //Start setUp.

            _spriteName = spriteName;

            if ( numberOfDirections == 0 && numberOfActions == 0 )
                _spriteAnimationList = new AnimationComponent[SpriteGlobals.numberOfDirections, SpriteGlobals.numberOfActions];

            else if ( numberOfDirections == 0 && numberOfActions != 0 )
                _spriteAnimationList = new AnimationComponent[SpriteGlobals.numberOfDirections, numberOfActions];

            else if ( numberOfDirections != 0 && numberOfActions == 0 )
                _spriteAnimationList = new AnimationComponent[numberOfDirections, SpriteGlobals.numberOfActions];

            else
                _spriteAnimationList = new AnimationComponent[numberOfDirections, numberOfActions];

            // Getting the size of the arrays:
            directionCount = _spriteAnimationList.GetLength(0);
            actionCount = _spriteAnimationList.GetLength(1);

            // Initializing the objects in the arrays:
            for ( i = 0; i < directionCount; i++ )
            {
                for ( j = 0; j < actionCount; j++ )
                {
                    _spriteAnimationList[ i, j ] = new AnimationComponent( _ownerID );
                }
            }
        }
        public AnimatedSingleComponent( AnimationComponent animation, int ownerID, Vector2 position, int width, int height, Texture2D texture, Nullable<Rectangle> sourceRect = null,
            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)
            : base(ownerID, position, width, height, texture, sourceRect, glow, tint, rotation, origin, scale, spriteEffect, layer)
        {
            // Start Constructor.

            _animation = animation;
        }
Esempio n. 3
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;
        }
Esempio n. 4
0
        public void setUpAction( SpriteGlobals.spriteDirections direction, SpriteGlobals.spriteActions action, AnimationComponent actionAnimation )
        {
            // Start setUpActionDefenition.

            _spriteAnimationList[ (int)direction, (int)action ] = actionAnimation;
        }
Esempio n. 5
0
 public void setCurrentAnimation( string key )
 {
     _currentAnimation.reset();
     _currentAnimation = _aimationList.getObject(key);
     _currentAnimation.start();
 }