using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace pcd_g1
{
	class KaminariBlockStageObject : BlockStageObject
	{
		Stage owner;

		public KaminariBlockStageObject(int x, int y, Stage stg) : base(x, y)
		{
			image = ImageManager.Search("243-2");
			Range = new FreeRectangleCollideRange(this);
			((FreeRectangleCollideRange) Range).Rect = new System.Drawing.RectangleF(0f,13F, 32F, 14F);

			owner = stg;
		}

		int animationCount = 0;
		public override void Update(int keyStatus, out int vx, out int vy)
		{
			base.Update(keyStatus, out vx, out vy);

			image = animationCount > 95 || animationCount < 90 && animationCount > 85 ?
				ImageManager.Search("243-2") : ImageManager.Search("243-1");
			if (++animationCount > 100) animationCount = 0;

			if (animationCount == 85)
			{
				if (owner.IsOnObject(owner.MainCharacter, CollideDirection.Down, this))
				{
					owner.MainCharacter.SignalProc(SignalType.SIGDAMAGE, 5, 0);
				}
				BombStageObject.Go(new KaminariBombStageObject(this.X, this.Y + 30, owner, this));
			}

		}

	}
}
