コード例 #1
0
ファイル: Skeleton.cs プロジェクト: LaudableBauble/Bedlam
        /// <summary>
        /// Initialize the skeleton.
        /// </summary>
        /// <param name="graphicsDevice">The graphics device to be used.</param>
        public void Initialize(GraphicsDevice graphicsDevice)
        {
            //Initialize variables.
            _Bones = new List<Bone>();
            _BoneUpdateOrder = _Bones;
            _Animations = new List<Animation>();
            _Sprites = new SpriteManager();

            _BoneBrush = new FarseerPhysics.DrawingSystem.LineBrush(1, Color.Black);
            _SelectedBoneBrush = new FarseerPhysics.DrawingSystem.LineBrush(1, Color.Green);
            _JointBrush = new FarseerPhysics.DrawingSystem.LineBrush(1, Color.Red);
            try
            {
                _BoneBrush.Load(graphicsDevice);
                _SelectedBoneBrush.Load(graphicsDevice);
                _JointBrush.Load(graphicsDevice);
            }
            catch { }

            //Set the skeleton's position to be the same as its root bone.
            _Position = RootBoneExists() ? GetRootBone().AbsolutePosition : Vector2.Zero;
        }
コード例 #2
0
ファイル: Skeleton.cs プロジェクト: LaudableBauble/Bedlam
        /// <summary>
        /// Initialize the skeleton.
        /// </summary>
        /// <param name="graphicsDevice">The graphics device to be used.</param>
        public void Initialize(GraphicsDevice graphicsDevice)
        {
            //Initialize variables.
            _Bones = new List<Bone>();
            _BoneUpdateOrder = _Bones;
            _Animations = new List<Animation>();
            _Sprites = new SpriteManager();
            _Position = HasRootBone() ? GetRootBone().StartPosition : Vector2.Zero;
            _Rotation = 0;

            //Initialize the bone brushes.
            _BoneBrush = new FarseerPhysics.DrawingSystem.LineBrush(1, Color.Black);
            _SelectedBoneBrush = new FarseerPhysics.DrawingSystem.LineBrush(1, Color.Green);
            _JointBrush = new FarseerPhysics.DrawingSystem.LineBrush(1, Color.Red);
            try
            {
                _BoneBrush.Load(graphicsDevice);
                _SelectedBoneBrush.Load(graphicsDevice);
                _JointBrush.Load(graphicsDevice);
            }
            catch { }
        }