Example #1
0
            public void Apply(float interpolationFactor, bool isNewFrame, IMemento nextFrame)
            {
                Enemy target = (Enemy)Target;

                if (nextFrame != null)
                {
                    float        thisInterp = 1 - interpolationFactor;
                    float        nextInterp = interpolationFactor;
                    EnemyMemento next       = (EnemyMemento)nextFrame;
                    target.position = position * thisInterp + next.position * nextInterp;
                    deathEmitterMemento.Apply(interpolationFactor, isNewFrame, ((EnemyMemento)nextFrame).deathEmitterMemento);
                }
                else
                {
                    target.position = position;
                    deathEmitterMemento.Apply(interpolationFactor, isNewFrame, null);
                }
                target.state             = state;
                target.targetedAI.Target = AItarget;
                target.health            = health;
                target.direction         = direction;
                target.rotation          = rotation;
                target.dying             = dying;
                target.maskingColor      = Color.Lerp(Color.Black, Color.White, health / STARTING_HEALTH);
            }