Пример #1
0
        private ICharacterRenderProperties GetRenderPropertiesForState(DisplayState displayState)
        {
            switch (displayState)
            {
            case DisplayState.Standing:
                return(_baseProperties);

            case DisplayState.SitChair:
                return(_baseProperties.WithSitState(SitState.Chair));

            case DisplayState.SitFloor:
                return(_baseProperties.WithSitState(SitState.Floor));

            case DisplayState.Attack1:
                return(_baseProperties.WithNextAttackFrame());

            case DisplayState.Attack2:
                return(_baseProperties.WithNextAttackFrame().WithNextAttackFrame());

            case DisplayState.Walk1:
                return(_baseProperties.WithNextWalkFrame());

            case DisplayState.Walk2:
                return(_baseProperties.WithNextWalkFrame().WithNextWalkFrame());

            case DisplayState.Walk3:
                return(_baseProperties.WithNextWalkFrame().WithNextWalkFrame().WithNextWalkFrame());

            case DisplayState.SpellCast:
                return(_baseProperties.WithNextSpellCastFrame());

            //create a clone of the properties for animation
            case DisplayState.WalkingAnimation:
            case DisplayState.SpellCastAnimation:
            case DisplayState.AttackingAnimation:
                return((ICharacterRenderProperties)_baseProperties.Clone());

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Пример #2
0
        private static ICharacterRenderProperties AnimateOneWalkFrame(ICharacterRenderProperties renderProperties)
        {
            var nextFrameRenderProperties = renderProperties.WithNextWalkFrame();

            if (nextFrameRenderProperties.CurrentAction != CharacterActionState.Walking)
            {
                nextFrameRenderProperties = nextFrameRenderProperties
                                            .WithMapX(nextFrameRenderProperties.GetDestinationX())
                                            .WithMapY(nextFrameRenderProperties.GetDestinationY());
            }

            return(nextFrameRenderProperties);
        }