Пример #1
0
        private void AnimateUpdate(UnitItem item, GameTime gameTime)
        {
            if (item.Animation != null && item.Animation.Ready)
            {
                item.Position = item.Animation.Position;
                item.Rotation = item.Animation.Rotation;

                item.Animation = null;
            }

            if (item.Animation != null)
                item.Animation.Update(gameTime);
        }
Пример #2
0
        private void StartIdle(UnitItem item, HexDirection dir)
        {
            HexPoint next = Point.Clone();
            next.MoveDir(dir);

            //_unit.SetTarget(next);

            float rotationY = (float)Point.AngleRad(next) + _unit.Data.ModelRotation;
            rotationY %= (float)Math.PI * 2;
            Vector3 newRotation = new Vector3(0, rotationY, 0);
            Vector3 delta = Vector3.Transform(item.RelativPosition, Matrix.CreateRotationY(rotationY));
            Vector3 newPosition = Position + delta;

            item.Animation = new ObjectAnimation(
                item.Position,
                newPosition,
                item.Rotation,
                newRotation,
                TimeSpan.FromSeconds(0.5f + item.StartOffset), false);
        }
Пример #3
0
 private void StartMoveMove(UnitItem item, Vector3 TargetPosition)
 {
     item.Animation = new ObjectAnimation(
         item.Position,
         TargetPosition,
         item.Rotation,
         item.Rotation,
         TimeSpan.FromSeconds(0.5f + item.StartOffset), false);
 }