Exemple #1
0
        public AnimationValues ApplyAnimations()
        {
            AnimationValues currentValues = provider.GetAnimationValues();

            foreach (Animation a in animations)
            {
                currentValues = a.ApplyTo(currentValues);
            }
            return(currentValues);
        }
Exemple #2
0
        public override AnimationValues ApplyTo(AnimationValues a)
        {
            //NOTICE ORDER!
            //Usually you would do Target - Source,
            //but we're not actually moving towards target,
            //the animation is sort of an... Unmove.
            //Codewise, the animatee is already at the targetposition,
            //We're just "slowing down" the visual movement there by
            //"unmoving" it, and then "unmoving" it less as time goes on.

            Vector2 fullDelta = Source - Target;
            //Above reason is also why we SUBTRACT the curve value from 1,
            //instead of using it directly.
            //CurveValue goes from 0 -> 1, and we need to apply from
            //full "unmove" (1) to none (0), so we reverse it with 1f - y.
            Vector2 apply = fullDelta * (1f - GetCurveValue());

            //((float)Remaining / Length);
            a.Position += apply;
            return(a);
        }
Exemple #3
0
        private void DrawUnit(Unit unit)
        {
            AnimationValues animationValues = unit
                                              .GetAnimateable()
                                              .ApplyAnimations();

            fbRectangle destination =
                Camera.WorldToScreen(
                    new fbRectangle(
                        animationValues.Position * tileSize,
                        new Vector2(tileSize)
                        )
                    );

            if (unit.Attacks > 0)
            {
                Engine.Draw(
                    Engine.GetTexture("ui-attackborder"),
                    destination,
                    Color.White
                    );
            }

            Engine.Draw(
                Engine.GetTexture(unit.UnitType.Texture),
                destination,
                unit.Owner == -1 //dc:ed
                    ? Color.Gray
                    : Game.World.GetPlayer(unit.Owner).Color
                );

            if (unit.WarpTarget != null)
            {
                fbRectangle beaconDestination =
                    Camera.WorldToScreen(
                        new fbRectangle(
                            unit.WarpTarget * tileSize,
                            tileSize
                            )
                        );

                Engine.Draw(
                    Engine.GetTexture("ui-warp-beacon"),
                    beaconDestination,
                    Color.White
                    );

                DrawLine(
                    destination.Position,
                    beaconDestination.Position,
                    1f,
                    new Color(0, 215, 255)
                    );
            }

            for (int i = 0; i < unit.Moves; i++)
            {
                Vector2 dingySize  = Engine.GetTextureSize("ui-move-dingy");
                Vector2 distancing = new Vector2(Camera.Scale(dingySize.X), 0);

                Engine.Draw(
                    Engine.GetTexture("ui-move-dingy"),
                    new fbRectangle(
                        destination.Position + distancing * i,
                        Camera.Scale(dingySize)
                        )
                    );
            }

            for (int i = 0; i < unit.Strength; i++)
            {
                Vector2 dingySize  = Engine.GetTextureSize("ui-strength-dingy");
                Vector2 distancing = new Vector2(0, Camera.Scale(dingySize.Y));

                Engine.Draw(
                    Engine.GetTexture("ui-strength-dingy"),
                    new fbRectangle(
                        destination.Position
                        + new Vector2(0, Camera.Scale(tileSize))
                        - distancing * (i + 1),
                        Camera.Scale(dingySize)
                        )
                    );
            }
        }
Exemple #4
0
 public abstract AnimationValues ApplyTo(AnimationValues a);