/// <summary>
        /// Performs an Attack for the specified Entity. The Entity's
        /// attack Type is evaluated and the appropriate attack is performed.
        /// </summary>
        /// <param name="entID">The Attacking Entity.</param>
        /// <typeparam name="T">The Team the Entity belongs to.</typeparam>
        protected void Attack <T>(ulong entID) where T : CTeam
        {
            CAI       AI = World.GetComponent <CAI>(entID);
            CDamage   damage;
            CPosition pos;
            CPosition targetPos;

            /// <summary>
            /// The AI has just attacked, so its cooldown is started.
            /// </summary>
            AI.LastAttackTime = World.GameTime;
            AI.AttackIsReady  = false;

            /// <summary>
            /// If the Attack Type is Melee, register an attack with the Damage System.
            /// If the Attack Type is Gun, create an Arrow Entity to travel towards the Target.
            /// </summary>
            switch (AI.AttackType)
            {
            case AttackType.Melee:
            {
                /// <summary>
                /// The System where Attacks are registered.
                /// </summary>
                DamageSystem damageSystem = World.GetSystem <DamageSystem>();

                damage = World.GetComponent <CDamage>(entID);
                damageSystem.RegisterAttack(AI.TargetID, damage.Damage);
                break;
            }

            case AttackType.Bow:
            {
                pos = World.GetComponent <CPosition>(entID);
                CBow bow = World.GetComponent <CBow>(entID);

                targetPos = World.GetComponent <CPosition>(AI.TargetID);

                EntityFactory.CreateArrow <T>(pos.Centre.X, pos.Centre.Y, bow, targetPos);
                break;
            }
            }
        }
        /// <summary>
        /// Creates an Entity with all Components of an Arrow and adds it to the World.
        /// This Entity represents the Arrows used by Archers of both teams.
        /// </summary>
        /// <param name="x">The x coordinate where the Entity will be created.</param>
        /// <param name="y">The y coordinate where the Entity will be created.</param>
        /// <param name="bow">The bow determining speed and damage of the Arrow.</param>
        /// <param name="targetPos">The position of the Entity the Arrow is heading towards.</param>
        /// <typeparam name="T">The team the Arrow belongs to</typeparam>
        public static void CreateArrow <T>(float x, float y, CBow bow, CPosition targetPos) where T : CTeam
        {
            //Create Entity and add to world
            ulong newEntity = _world.NextEntityID;

            //Create components and pass to world to send to Systems
            List <Component> components = new List <Component>();

            components.Add(new CPosition(x, y, ARROW_SIZE));
            components.Add(new CDamage(bow.ArrowDamage));
            components.Add(new CCollidable());
            components.Add(new CProjectile());
            components.Add(new CDamagesOnImpact(true));

            //Calculate the centre of the passed in position to be the Arrow's target.
            float targetCentreX = targetPos.X + (targetPos.Width / 2);
            float targetCentreY = targetPos.Y + (targetPos.Height / 2);

            //Calculate appropriate velocities for Arrow to reach target.
            Vector velocity = Utils.GetVectorBetweenPoints(x, y, targetCentreX, targetCentreY, bow.ArrowSpeed);

            components.Add(new CVelocity(velocity.X, velocity.Y, bow.ArrowSpeed));

            if (typeof(T) == typeof(CPlayerTeam))
            {
                components.Add(new CPlayerTeam());
                components.Add(new CRenderable(SwinGame.BitmapNamed("PlayerArrow")));
            }
            else if (typeof(T) == typeof(CEnemyTeam))
            {
                components.Add(new CEnemyTeam());
                components.Add(new CRenderable(SwinGame.BitmapNamed("Arrow")));
            }

            _world.AddEntity(newEntity, components);
        }