Exemplo n.º 1
0
        //-----------------------------------------------------------------------------
        // Overridden methods
        //-----------------------------------------------------------------------------

        public override bool OnPush(int direction, float movementSpeed)
        {
            if (base.OnPush(direction, MOVEMENT_SPEED))
            {
                offset = Directions.ToPoint(direction);

                ColorCubeOrientation oldOrientation = orientation;

                // Find the new sprite index.
                if (Directions.IsVertical(direction))
                {
                    orientation = (ColorCubeOrientation)GMath.Wrap((int)orientation + 3, 6);
                }
                else if ((int)orientation % 2 == 0)
                {
                    orientation = (ColorCubeOrientation)GMath.Wrap((int)orientation - 1, 6);
                }
                else
                {
                    orientation = (ColorCubeOrientation)GMath.Wrap((int)orientation + 1, 6);
                }

                // Play the corresponding animation.
                Graphics.PlayAnimation(GameData.ANIM_COLOR_CUBE_ROLLING_ORIENTATIONS[(int)oldOrientation, direction]);

                // Set an absolute draw position because the animation should not move with the tile.
                Graphics.SetAbsoluteDrawPosition(Position);

                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
        public override void OnInitialize()
        {
            base.OnInitialize();

            int orientationIndex = Properties.GetInteger("orientation", 0);

            orientation = (ColorCubeOrientation)orientationIndex;
            Graphics.PlaySpriteAnimation(SpriteList[orientationIndex]);
        }
Exemplo n.º 3
0
        public override void OnInitialize()
        {
            base.OnInitialize();

            int orientationIndex = Properties.GetInteger("orientation", 0);
            orientation = (ColorCubeOrientation) orientationIndex;
            Graphics.PlaySpriteAnimation(SpriteList[orientationIndex]);
        }
Exemplo n.º 4
0
        //-----------------------------------------------------------------------------
        // Overridden methods
        //-----------------------------------------------------------------------------
        public override bool OnPush(int direction, float movementSpeed)
        {
            if (base.OnPush(direction, MOVEMENT_SPEED)) {
                offset = Directions.ToPoint(direction);

                ColorCubeOrientation oldOrientation = orientation;

                // Find the new sprite index.
                if (Directions.IsVertical(direction))
                    orientation = (ColorCubeOrientation) GMath.Wrap((int) orientation + 3, 6);
                else if ((int) orientation % 2 == 0)
                    orientation = (ColorCubeOrientation) GMath.Wrap((int) orientation - 1, 6);
                else
                    orientation = (ColorCubeOrientation) GMath.Wrap((int) orientation + 1, 6);

                // Play the corresponding animation.
                Graphics.PlayAnimation(GameData.ANIM_COLOR_CUBE_ROLLING_ORIENTATIONS[(int) oldOrientation, direction]);

                // Set an absolute draw position because the animation should not move with the tile.
                Graphics.SetAbsoluteDrawPosition(Position);

                return true;
            }
            return false;
        }