/// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            NewMouseState = Mouse.GetState();

            this.MousePosition = new Vector2(this.NewMouseState.X,
                                             this.NewMouseState.Y);

            CurrentLeaf = LeafNodes[0];
            CurrentLeaf.Update(gameTime);

            iterationCount = 0;

            CurrentLeaf = LeafNodes[1];
            CurrentLeaf.Update(gameTime);


            //for (int i = EntityList.Count - 1; i >= 0; i--)
            //{
            //    EntityList[i].Update(gameTime);
            //}

            //base.Update(gameTime);
        }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            BoneEntity LastEntity = null;

            for (int i = 0; i < BONE_COUNT; i++)
            {
                BoneEntity NewEntity = new BoneEntity(this);
                if (LastEntity == null)
                {
                    NewEntity.Position.X = 100.0f;
                    NewEntity.Position.Y = 450.0f;
                }
                else
                {
                    NewEntity.ParentBone = LastEntity;
                    LastEntity.ChildBone = NewEntity;
                }

                NewEntity.DestRectangle        = new Rectangle();
                NewEntity.DestRectangle.X      = (int)NewEntity.Position.X;
                NewEntity.DestRectangle.Y      = (int)NewEntity.Position.Y;
                NewEntity.DestRectangle.Width  = NewEntity.Texture.Width;
                NewEntity.DestRectangle.Height = NewEntity.Texture.Height;
                this.EntityList.Add(NewEntity);
                LastEntity = NewEntity;
            }
            LeafNodes[0] = LastEntity;
            LastEntity   = null;

            for (int i = 0; i < BONE_COUNT; i++)
            {
                BoneEntity NewEntity = new BoneEntity(this);
                if (LastEntity == null)
                {
                    NewEntity.Position.X = 600.0f;
                    NewEntity.Position.Y = 450.0f;
                }
                else
                {
                    NewEntity.ParentBone = LastEntity;
                    LastEntity.ChildBone = NewEntity;
                }

                NewEntity.DestRectangle        = new Rectangle();
                NewEntity.DestRectangle.X      = (int)NewEntity.Position.X;
                NewEntity.DestRectangle.Y      = (int)NewEntity.Position.Y;
                NewEntity.DestRectangle.Width  = NewEntity.Texture.Width;
                NewEntity.DestRectangle.Height = NewEntity.Texture.Height;
                this.EntityList.Add(NewEntity);
                LastEntity = NewEntity;
            }
            LeafNodes[1] = LastEntity;

            base.Initialize();
        }
Пример #3
0
 public EffectorEntity(InverseKinematicGame Game, BoneEntity BoneEntity)
 {
     this.Game       = Game;
     this.Texture    = this.Game.Content.Load <Texture2D>("effector");
     this.BoneEntity = BoneEntity;
 }