Пример #1
0
        private SimpleSprite(
			ImageGroup imageGroup,
			Direction direction,
			int imageIndex,
			int animationIndex,
			int animationCount)
        {
            this.direction = direction;
            image = imageGroup.Images[imageIndex];
            animation = imageGroup.Images.Skip(animationIndex).Take(animationCount).ToArray();
        }
Пример #2
0
        private static Dictionary<Direction, SimpleSprite> LoadSprites(
			ImageGroup imageGroup,
			int imageIndex,
			int animationIndex,
			int animationCount)
        {
            return EnumEx.GetValues<Direction>()
                .Select((direction, index) => new SimpleSprite(
                    imageGroup,
                    direction,
                    imageIndex + index,
                    animationIndex + index * animationCount,
                    animationCount))
                .ToDictionary(sprite => sprite.direction, sprite => sprite);
        }
Пример #3
0
        private Sprite(
			ImageGroup imageGroup,
			Direction direction,
			int emptyLeftArmIndex,
			int twoHandedLeftArmIndex,
			int leftArmAnimationIndex,
			int emptyRightArmIndex,
			int oneHandedRightArmIndex,
			int twoHandedRightArmIndex,
			int firingRightArmIndex,
			int rightArmAnimationIndex,
			int legsStandingIndex,
			int legsKneelingIndex,
			int legsAnimationIndex,
			int headIndex)
        {
            this.direction = direction;
            emptyLeftArm = imageGroup.Images[emptyLeftArmIndex];
            twoHandedLeftArm = imageGroup.Images[twoHandedLeftArmIndex];
            leftArmAnimation = imageGroup.Images.Skip(leftArmAnimationIndex).Take(8).ToArray();
            emptyRightArm = imageGroup.Images[emptyRightArmIndex];
            oneHandedRightArm = imageGroup.Images[oneHandedRightArmIndex];
            twoHandedRightArm = imageGroup.Images[twoHandedRightArmIndex];
            firingRightArm = imageGroup.Images[firingRightArmIndex];
            rightArmAnimation = imageGroup.Images.Skip(rightArmAnimationIndex).Take(8).ToArray();
            legsStanding = imageGroup.Images[legsStandingIndex];
            legsKneeling = imageGroup.Images[legsKneelingIndex];
            legsAnimation = imageGroup.Images.Skip(legsAnimationIndex).Take(8).ToArray();
            head = imageGroup.Images[headIndex];

            if (imageGroup == ImageGroup.SoldierPersonalArmor && this.direction == Direction.South)
            {
                var temp = rightArmAnimation;
                rightArmAnimation = leftArmAnimation;
                leftArmAnimation = temp;
            }
            if (imageGroup == ImageGroup.Muton)
            {
                walkingOffsets = new[] { 1, 1, 0, -1, 1, 1, 0, -1 };
                armOffsets = new[] { 0, 0, -1, -2, 0, 0, -1, -2 };
            }
            if (imageGroup == ImageGroup.Sectoid)
                weaponOffset = 6;
        }
Пример #4
0
        private static Dictionary<Direction, Sprite> LoadSprites(
			ImageGroup imageGroup,
			int emptyLeftArm,
			int twoHandedLeftArm,
			int leftArmAnimation,
			int emptyRightArm,
			int oneHandedRightArm,
			int twoHandedRightArm,
			int firingRightArm,
			int rightArmAnimation,
			int legsStanding,
			int legsKneeling,
			int legsAnimation,
			int head)
        {
            return EnumEx.GetValues<Direction>()
                .Select((direction, index) => new Sprite(
                    imageGroup,
                    direction,
                    emptyLeftArm + index,
                    twoHandedLeftArm + index,
                    leftArmAnimation + index * 24,
                    emptyRightArm + index,
                    oneHandedRightArm + index,
                    twoHandedRightArm + index,
                    firingRightArm + index,
                    rightArmAnimation + index * 24,
                    legsStanding + index,
                    legsKneeling + index,
                    legsAnimation + index * 24,
                    head + index))
                .ToDictionary(sprite => sprite.direction, sprite => sprite);
        }
Пример #5
0
 private static TileMetadata Create(ImageGroup imageGroup, PartData[] parts)
 {
     return new TileMetadata
     {
         ImageGroup = imageGroup,
         Parts = parts
     };
 }
Пример #6
0
 private Animation(ImageGroup imageGroup, int index, int count)
 {
     images = imageGroup.Images.Skip(index).Take(count).ToArray();
 }