using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;

namespace KinPortal {
	public class TargetCollisionStrategy : CollisionStrategy {
		private TimeSpan m_reloadTime;
		private bool m_lock = false;


		public void Update(InterruptorObject obj, GameTime gameTime) {
			if(m_lock) {
				m_reloadTime += gameTime.ElapsedGameTime;
				if(m_reloadTime.Milliseconds >= 300.0) {
					m_lock = false;
				}
			}
		}

		public void Collision(InterruptorObject hostObj, DynamicObject obj) {
			if(obj.IsStatic == true || m_lock) {
				return;
			}

			DynamicObject o = new DynamicObject(
				"models\\monkey",
				new Vector3(0, 0, 8.0f), Quaternion.Identity,
				hostObj.Scene, ShapeType.SPHERE, false, new GrabStrategy()
			);

			//o.PhysicModel.AffectedByGravity = false;

			hostObj.Scene.AddComponent(o);

			m_lock = true;
			m_reloadTime = TimeSpan.Zero;
		}
	}
}
