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

namespace pcd_g1
{
	class SwordWeaponCharacterStageObject:CharacterStageObject
	{
		public bool Swinging { get; set; }//剣が振られている
		public enum Direction { Left, Right }
		public Direction ImageDirection { get; set; }//画像を表示する向き

		private MainCharacterStageObject ownerCharacter = null;

		public SwordWeaponCharacterStageObject(int x, int y, Stage stg, MainCharacterStageObject character): base(x, y, stg)
		{
			isFloating = true;
			Swinging = false;
			ownerCharacter = character;
		}

		public override void Draw(System.Drawing.Graphics g, int width, int height)
		{
			if (Swinging == false)
				return;

			switch (ImageDirection)
			{
				case Direction.Right:
					g.DrawImage(ImageManager.Search("840-3"),0,0);
					break;
				case Direction.Left:
					g.DrawImage(ImageManager.Search("840-4"),0,0);
					break;
			}
		}

		public override bool EventProc(EventType type, IStageObject sender, CollideDirection direction)
		{
			if (Swinging == true)
			{
				if (type == EventType.BeTouched || type == EventType.Touched)
				{
					if (!(sender == ownerCharacter))
						sender.SignalProc(SignalType.SIGDAMAGE, 1, 0);
				}
			}

			return base.EventProc(type, sender, direction);
		}
	}
}
