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

namespace pcd_g1
{
	class TogeBlockStageObject : BlockStageObject
	{
		int _damage;
		public TogeBlockStageObject(int x, int y, string imgName, int damage = -1)
			: base(x, y)
		{
			image = ImageManager.Search(imgName);
			Range = new FreeRectangleCollideRange(this);
			switch (imgName)
			{
				case "865":
					((FreeRectangleCollideRange)Range).Rect = new System.Drawing.RectangleF(0f, 18f, 32f, 14f);
					break;
				case "866":
					((FreeRectangleCollideRange)Range).Rect = new System.Drawing.RectangleF(0f, 0f, 14f, 32f);
					break;
				case "867":
					((FreeRectangleCollideRange)Range).Rect = new System.Drawing.RectangleF(18f, 0f, 14f, 32f);
					break;
				case "868":
					((FreeRectangleCollideRange)Range).Rect = new System.Drawing.RectangleF(0f, 0f, 32f, 14f);
					break;
				default:
					((FreeRectangleCollideRange)Range).Rect = new System.Drawing.RectangleF(5f, 5f, 22f, 22f);
					break;
			} 
			_damage = damage;
		}

		public override bool EventProc(EventType type, IStageObject sender, CollideDirection direction)
		{
			switch(type)
			{
				case EventType.BeCollided:
					if(sender is MainCharacterStageObject)
					{
						if (_damage == -1)
						{
							sender.SignalProc(SignalType.SIGKILL, 99999, 0);
						}
						else
						{
							sender.SignalProc(SignalType.SIGDAMAGE, _damage, 0);
						}
					}
					break;
			}
				return base.EventProc(type, sender, direction);
		}
	}
}
