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

namespace pcd_g1
{
    class BananaBlockStageObject : ItemStageObject
    {
        Random r;

        public BananaBlockStageObject(int x, int y, Stage stg) : base (x, y, stg)
        {
            image = ImageManager.Search("935");
            Range = new FreeRectangleCollideRange(this);
            ((FreeRectangleCollideRange)Range).Rect = new System.Drawing.RectangleF(0, 31, 32, 1);
            r = new Random();
        }

        public override void Update(int keyStatus, out int vx, out int vy)
        {
            //if (owner.MainCharacter.X + owner.MainCharacter.Width > this.X && owner.MainCharacter.X < this.X + this.Width)
            //{
            //    if (owner.IsOn(this, CollideDirection.Up))
            //    {

            //    }
            //}
            base.Update(keyStatus, out vx, out vy);
        }

        public override bool EventProc(EventType type, IStageObject sender, CollideDirection direction)
        {
            if (type == EventType.BeTouched && sender is MainCharacterStageObject)
            {
                sender.SignalProc(SignalType.SIGPUSH, r.Next(-3, 3), 0);
            }
            
            return base.EventProc(type, sender, direction);
        }


    }
}
