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

namespace pcd_g1
{
	abstract class ItemStageObject : IStageObject
	{
		public int X { get; set; }
		public int Y { get; set; }
		public int Width { get; protected set; }
		public int Height { get; protected set; }
		public bool Visibility { get; private set; }
		public bool CanCrash { get; private set; }
		public CollideRange Range { get; protected set; }

		protected Bitmap image;
		protected Stage owner;

		public ItemStageObject(int x, int y, Stage stage)
		{
			X = x; Y = y;
			Width = 32; Height = 32;
			Visibility = true;
			CanCrash = false;
			owner = stage;
			Range = new NormalCollideRange(this);
		}

		/// <summary> アイテムの位置などを更新する。 </summary>
		public virtual void Update(int keyStatus, out int vx, out int vy)
		{
			vx = 0; vy = 0;
		}

		/// <summary> アイテムを描画する。 </summary>
		public virtual void Draw(Graphics g, int width, int height)
		{
			if (image != null)
				g.DrawImage(image, 0, 0, width, height);
		}

		public virtual bool EventProc(EventType type, IStageObject sender, CollideDirection direction)
		{
			return true;
		}

		public virtual void SignalProc(SignalType type, int arg1, int arg2)
		{
			if (type == SignalType.SIGKILL)
			{
				SignalProc(SignalType.SIGDAMAGE, 99999, 0);
				owner.Remove(this);
			}
		}
	}
}
