예제 #1
0
파일: Player.cs 프로젝트: bmike7/GameDev
        public override void Update(GameTime gameTime, BaseLevel level)
        {
            base.Update(gameTime, level);

            MouseState mouseState = Mouse.GetState();

            if (Utility.isMouseLeftButtonClicked(mouseState, _prevMouseState) && CanChangeAnimation())
            {
                Bullet firedBullet = shoot(
                    elapsedMs: gameTime.TotalGameTime.TotalMilliseconds,
                    from: new Vector2(CollisionRectangle.X + CollisionRectangle.Width, CollisionRectangle.Y),
                    direction: _movement.Direction
                    );

                if (firedBullet != null)
                {
                    _movement.Action = MovementAction.SHOOT;
                }

                level.AddFiredShot(firedBullet);
            }

            _prevMouseState = mouseState;
        }