示例#1
0
 /// <summary>
 /// Attackiert mit der Waffe
 /// </summary>
 public void Swing()
 {
     if (item != null)
     {
         usingItem = true;
     }
     swing.Reverse();
 }
示例#2
0
 private void GuiCheckbox_OnClick(object sender, MouseEventArgs e)
 {
     if (e.X > this.X + Width - tokenWidth && OnHover(e))
     {
         if (check.Finished)
         {
             check.Reverse();
         }
     }
 }
示例#3
0
        public EntityLivingBase(Rectangle[] bounds) : base(bounds)
        {
            //TileMaps für die BegweungsAnimationen
            Bitmap[][] images = new Bitmap[][] { ResourceManager.GetImages(this, "Right"), ResourceManager.GetImages(this, "Left") };
            //Einfärben für die Hurttime
            Bitmap[][] hurtTimeImages = new Bitmap[images.Length][];
            for (int i = 0; i < images.Length; i++)
            {
                hurtTimeImages[i] = new Bitmap[images[i].Length];
                for (int j = 0; j < images[i].Length; j++)
                {
                    hurtTimeImages[i][j] = RenderUtils.PaintBitmap(images[i][j], Color.Red, true);
                }
            }
            //Erstellen der Bewegungs-Animation und
            this.animations        = new FrameAnimation[] { new FrameAnimation(FPS, false, images[0]), new FrameAnimation(FPS, false, images[1]) };
            this.hurtTimeAnimation = new FrameAnimation[] { new FrameAnimation(FPS, false, hurtTimeImages[0]), new FrameAnimation(FPS, false, hurtTimeImages[1]) };

            Facing    = EnumFacing.RIGHT;
            animation = animations[0];
            //Erstellen der BoundingBox für Kollisionen
            Box = new BoundingBox(this, animation.Image.Width, animation.Image.Height);
            //Erstellen der Schlag- und TodesAnimation
            swing = CustomAnimation <float> .CreateDefaultAnimation(1.0f);

            swing.Toleranz  = 1E-2f;
            swing.OnFinish += (object sender, EventArgs args) =>
            {
                if (swing.Increments)
                {
                    swing.Reverse();
                }
            };
            swing.Reverse();
            death = CustomAnimation <float> .CreateDefaultAnimation(1.0f);

            death.Toleranz = 1e-5f;
            Health         = 20;
        }
示例#4
0
 private void CreateNewAnimation()
 {
     check = new CustomAnimation <float>(0.0f, 1.0f, (float current, float delta) => current + delta)
     {
         Toleranz = 1E-3f
     };                         //Animation für den Haken
     check.OnFinish += (object o, EventArgs args) => {
         if (!check.Increments) //Soll wieder groß werden wenn es klein geworden ist
         {
             state = !state;
             token = state ? ((char)10003).ToString() : ((char)10007).ToString();
             check.Reverse();
         }
     };
     check.Fire();
 }