コード例 #1
0
        private void AttackTop()
        {
            this.spriteTexture = attackUpTexture;
            Point     topLeftPoint     = new Point(this.locationRect.Left, this.locationRect.Top - spriteTexture.Height);
            Point     bottomRightPoint = new Point(this.locationRect.Right, this.locationRect.Top);
            Rectangle attackZoneTop    = new Rectangle(topLeftPoint, bottomRightPoint);

            this.attackDir = PlayerAttackDir.Up;
        }
コード例 #2
0
        private void AttackDown()
        {
            this.spriteTexture = attackDownTexture;
            Point     topLeftPoint     = new Point(this.locationRect.Left, this.locationRect.Bottom);
            Point     bottomRightPoint = new Point(this.locationRect.Right, this.locationRect.Bottom + this.spriteTexture.Height);
            Rectangle attackZoneBottom = new Rectangle(topLeftPoint, bottomRightPoint);

            this.attackDir = PlayerAttackDir.Down;
        }
コード例 #3
0
        private void AttackRight()
        {
            this.spriteTexture = attackRightTexture;
            Point     topLeftPoint     = new Point(this.locationRect.Right, this.locationRect.Top);
            Point     bottomRightPoint = new Point(this.locationRect.Right + this.spriteTexture.Width, this.locationRect.Bottom);
            Rectangle attackZoneRight  = new Rectangle(topLeftPoint, bottomRightPoint);

            this.attackDir = PlayerAttackDir.Right;
        }
コード例 #4
0
 private void ResetIdleSprite(float timeInMs)
 {
     if (this.spriteTexture != idleTexture && controller.HandleKeyboard() == "No Input")
     {
         this.attackDir = PlayerAttackDir.Idle;
         currentTime   += timeInMs / 1000;
         if (currentTime >= timeBeforeIdleReset)
         {
             this.spriteTexture = idleTexture;
             currentTime        = 0f;
         }
     }
     else if (controller.HandleKeyboard() != "No Input")
     {
         currentTime = 0f;
         IsHurt      = false;
     }
 }
コード例 #5
0
 public override void Initialize()
 {
     this.attackDir = PlayerAttackDir.Idle;
     base.Initialize();
 }