protected void OnCollision(Collider2D other, Identity identity, BulletComponent bulletComponent, Animator animator, BoxCollider2D boxCollider2D, MoveComponent move)
    {
        Entity   otherEntity   = other.gameObject.GetComponent <EntityHolder>().entity;
        Identity otherIdentity = otherEntity.identity;

        if (otherIdentity.tag == "brick" || otherIdentity.tag == "stone")
        {
            //identity.isDead = true;
            if (other.gameObject.tag == "brick")
            {
                world.entitySystem.DestroyEntity(otherEntity);
            }
        }
        else if (otherEntity != identity.master && otherIdentity.tag == "tank")
        {
            //identity.isDead = true;
            //other.gameObject.GetComponent<Life>().ChangeHP(-bulletComponent.damage);
            world.buffSystem.AddBuff(otherEntity, bulletComponent.buffName);
            Debug.Log("bullet hit tank");
        }

        if (otherIdentity.tag != "river")
        {
            move.needMove   = false;
            identity.isDead = true;
        }

        if (identity.isDead == true)
        {
            animator.SetBool("destroy", true);
            boxCollider2D.enabled = false; // disable collider to avoid mutiple times collision.
        }
    }
    public void Update(Identity identity, BulletComponent bullet, MoveComponent move, GameobjectComponent gameobjectComponent)
    {
        if (bullet == null || bullet.enable == false)
        {
            return;
        }

        Transform     transform     = gameobjectComponent.transform;
        BoxCollider2D boxCollider2D = gameobjectComponent.collider;
        Animator      animator      = gameobjectComponent.animator;

        boxCollider2D.enabled = false;
        Collider2D otherCollider = Physics2D.OverlapBox(transform.position, boxCollider2D.size, transform.rotation.z * Mathf.Deg2Rad);

        if (otherCollider != null)
        {
            OnCollision(otherCollider, identity, bullet, animator, boxCollider2D, move);
        }
        boxCollider2D.enabled = true;

        bullet.currentDistance += move.moveSpeed * Time.fixedDeltaTime;

        AnimatorStateInfo info = animator.GetCurrentAnimatorStateInfo(0);

        if (bullet.currentDistance > bullet.shootDistance)
        {
            world.entitySystem.DestroyEntity(identity.entity);
        }
        else if (info.normalizedTime >= 1.0f)
        {
            world.entitySystem.DestroyEntity(identity.entity);
        }
    }
Exemple #3
0
        protected bool DestroyOnAnyTargetHit(Entity bulletEntity, BulletComponent bullet, BulletConfigComponent config, TargetingData targeting)
        {
            bool flag;

            using (List <DirectionData> .Enumerator enumerator = targeting.Directions.GetEnumerator())
            {
                while (true)
                {
                    if (enumerator.MoveNext())
                    {
                        DirectionData current = enumerator.Current;
                        if (current.Targets.Count <= 0)
                        {
                            continue;
                        }
                        TargetData data2 = current.Targets.First <TargetData>();
                        this.SetPositionNearHitPoint(bullet, data2.HitPoint);
                        this.SendBulletTargetHitEvent(bulletEntity, bullet, data2.TargetEntity);
                        this.DestroyBullet(bulletEntity);
                        flag = true;
                    }
                    else
                    {
                        return(false);
                    }
                    break;
                }
            }
            return(flag);
        }
    IEnumerator SusppendCollision(float time, BulletComponent bullet)
    {
        bullet.canContact = false;
        yield return(new WaitForSeconds(time));

        bullet.canContact = true;
    }
    public void StartNewGame()
    {
        if (this.currentlyActiveQuestObject != null)
        {
            Destroy(this.currentlyActiveQuestObject.gameObject);
            this.currentlyActiveQuestObject = null;
        }

        if (this.currentlyUsedBullet != null)
        {
            Destroy(this.currentlyUsedBullet.gameObject);
            this.currentlyUsedBullet           = null;
            this.weaponController.loadedBullet = null;
        }

        this.weaponController.Resume();
        this.currentlyUsedBullet = this.weaponController.LoadNewBullet().GetComponent <BulletComponent>();
        this.currentlyUsedBullet.AddListenerToBullet(this.OnBulletDeactivation);

        this.currentlyUsedBullet = this.weaponController.LoadNewBullet().GetComponent <BulletComponent>();
        this.currentlyUsedBullet.AddListenerToBullet(this.OnBulletDeactivation);

        this.thisLevelSpawnCountGoal = Player.playerProgressData[this.currentlySelectedProblem].levelsSpawnCount[this.currentLevel];
        this.spawnCount = 1;
        this.UpdateSpawnCount();

        this.SpawnNewQuestion(ProblemManager.GetNewQuestion(this.currentlySelectedProblem, this.currentLevel, this.spawnCount));

        this.isAGameRunning = true;
    }
Exemple #6
0
        public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex)
        {
            var chunkTranslations = chunk.GetNativeArray(translationType);
            var chunkBullets      = chunk.GetNativeArray(bulletComponentType);
            var chunkEntities     = chunk.GetNativeArray(entityType);

            for (int i = 0; i < chunk.Count; i++)
            {
                var vec0   = chunkBullets[i].vec;
                var vec1   = vec0 - math.up() * 9.8f * deltaTime;
                var newPos = chunkTranslations[i].Value + (vec0 + vec1) * 0.5f * deltaTime;

                chunkBullets[i] = new BulletComponent {
                    vec = vec1
                };
                chunkTranslations[i] = new Translation {
                    Value = newPos
                };

                if (newPos.y < 0 && vec1.y < 0)
                {
                    commandBuffer.DestroyEntity(chunkIndex, chunkEntities[i]);
                }
            }
        }
Exemple #7
0
    IEnumerator WaitWhileInactive(BulletComponent bullet)
    {
        bullet.canCheck = false;
        yield return(new WaitForSeconds(timeWhileBulletInactive));

        bullet.canCheck = true;
    }
Exemple #8
0
        protected void SetPositionNearHitPoint(BulletComponent bullet, Vector3 hitPoint)
        {
            Vector3 vector = hitPoint - bullet.Position;
            float   num    = Vector3.Dot(bullet.Direction, vector.normalized);

            bullet.Position += bullet.Direction * ((vector.magnitude * num) - bullet.Radius);
        }
Exemple #9
0
    protected override void Shoot()
    {
        if (CreateBullet() && QueueShoot)
        {
            Game.ChangeQueue();
            Products[typeBullet].Reduce();
            Vector2 direction = MovementPart.position - Slider.transform.position;
            var     distance  = Vector2.Distance(MovementPart.position, Slider.transform.position) / maxStretch;

            // Хуйня но я заебался уже
            if (!(MovementPart.localRotation.eulerAngles.z > 360 - maxAngle || MovementPart.localRotation.eulerAngles.z < maxAngle))
            {
                if ((MovementPart.localRotation.eulerAngles.z < 360 - maxAngle))
                {
                    direction = MovementPart.position - rightBlock.position;
                }
                else
                {
                    direction = MovementPart.position - leftBlock.position;
                }
            }

            BulletComponent.Shoot(direction * Force * distance);

            catapultLine.SetPosition(1, catapultLine.GetPosition(0));
            Slider.transform.position = startSliderPosition;
            _clickedOn      = false;
            BulletComponent = null;
            StartCoroutine(RotateToStarWithDelay(0f));
        }
    }
    private void Start()
    {
        if (createParent)
        {
            var enemieParentGO = new GameObject("Bullets");
            bulletsParent = enemieParentGO.transform;
        }
        var numOfEnemieSettings = bulletsData.Length;

        bullets    = new List <BulletComponent>();
        bulletPool = new Dictionary <EBulletName, Queue <GameObject> >();
        for (int i = 0; i < numOfEnemieSettings; i++)
        {
            var bulletsQueues = new Queue <GameObject>();
            for (int j = 0; j < bulletsData[i].maxNumOnScreen; j++)
            {
                GameObject      newBulletGO = Instantiate(bulletsData[i].prefab) as GameObject;
                BulletComponent bullet      = newBulletGO.GetComponent <BulletComponent>();
                bullets.Add(bullet);
                bulletsQueues.Enqueue(newBulletGO);
                bullet.bulletName        = bulletsData[i].bulletName;
                bullet.damage            = bulletsData[i].damage;
                bullet.speed             = bulletsData[i].speed;
                bullet.delayAfetShooting = bulletsData[i].delayAfterShooting;
                newBulletGO.SetActive(false);
                if (createParent)
                {
                    newBulletGO.transform.parent = bulletsParent;
                }
            }
            bulletPool.Add(bulletsData[i].bulletName, bulletsQueues);
        }
    }
    private int SortByDistance(BulletComponent a, BulletComponent b)
    {
        float distA = Vector3.Distance(new Vector3(a.stats.position.x, a.stats.position.y, 0), p.transform.position);
        float distB = Vector3.Distance(new Vector3(b.stats.position.x, b.stats.position.y, 0), p.transform.position);

        return(distA.CompareTo(distB));
    }
 public void HandleFrame(UpdateBulletEvent e, BulletNode bulletNode)
 {
     BulletComponent bullet = bulletNode.bullet;
     BulletConfigComponent bulletConfig = bulletNode.bulletConfig;
     DirectionData data = e.TargetingData.Directions[0];
     if (data.StaticHit != null)
     {
         Vector3 position = data.StaticHit.Position;
         base.ScheduleEvent(new RicochetBulletBounceEvent(position), bulletNode);
         bullet.Distance += (bullet.Position - data.StaticHit.Position).magnitude;
         this.ProcessRicochet(bullet, data.StaticHit);
     }
     else
     {
         if (base.DestroyOnAnyTargetHit(bulletNode.Entity, bullet, bulletConfig, e.TargetingData))
         {
             return;
         }
         base.MoveBullet(bulletNode.Entity, bullet);
     }
     if (bullet.Distance > bulletConfig.FullDistance)
     {
         base.DestroyBullet(bulletNode.Entity);
     }
 }
Exemple #13
0
    public void Update(Identity identity, BulletComponent bullet, MoveComponent move, GameobjectComponent gameobjectComponent)
    {
        if (bullet == null || bullet.enable == false)
        {
            return;
        }

        Transform     transform     = gameobjectComponent.transform;
        BoxCollider2D boxCollider2D = gameobjectComponent.collider;

        if (!identity.isDead)
        {
            boxCollider2D.enabled = false;
            Collider2D otherCollider = Physics2D.OverlapBox(transform.position, boxCollider2D.size, transform.rotation.eulerAngles.z);
            if (otherCollider != null)
            {
                OnCollision(otherCollider, identity, bullet, boxCollider2D, move);
            }
            boxCollider2D.enabled = true;

            MoveSystem.MoveForward(transform, move.moveSpeed);
            bullet.currentDistance += move.moveSpeed * Time.fixedDeltaTime;
            if (bullet.currentDistance > bullet.shootDistance)
            {
                world.entitySystem.DestroyEntity(identity.entity);
            }
        }
    }
        private void _createBullet(IEntity entity)
        {
            var viewComponent    = entity.GetComponent <ViewComponent>();
            var go               = viewComponent.View.gameObject;
            var startPosition    = go.transform.position + (go.transform.up * 0.25f);
            var bullet           = _pool.CreateEntity();
            var enemyMask        = 1 << LayerMask.NameToLayer("Enemy");
            var destructibleMask = 1 << LayerMask.NameToLayer("Destructible");
            var finalMask        = enemyMask | destructibleMask;
            var bulletComponent  = new BulletComponent()
            {
                startPosition = startPosition,
                rotation      = _addDispersion(go.transform.rotation),
                elapsedTime   = 0,
                lifeTime      = .8f,
                collisionMask = finalMask
            };
            var actorComponent = new ActorComponent()
            {
                damage = 5
            };

            bullet.AddComponent(bulletComponent);
            bullet.AddComponent(actorComponent);
            bullet.AddComponent(new ViewComponent());
        }
Exemple #15
0
        private void OnBulletHitCharacter(BulletComponent bullet, CharacterComponent character)
        {
            character.Hit();
            if (character.CurrentHealth <= 0 && bullet.Source != null)
            {
                bullet.Source.Player.IncrementScore((bullet.Source == character) ? -1 : 1);

                //GameObject go = PrefabFactory.Pop("bulletexplode");
                //go.transform.position = bullet.transform.position;
                //this.DelayAction(8, () => PrefabFactory.Push("bulletexplode", go));

                GameObject explode = PrefabFactory.Pop("vfxexplode");
                explode.transform.position = bullet.transform.position + (UnityEngine.Camera.main.transform.position - bullet.transform.position).normalized;
                this.DelayAction(5, () => PrefabFactory.Push("vfxexplode", explode));

                GameObject shock = PrefabFactory.Pop("shockwave");
                shock.transform.position = bullet.transform.position;
                shock.transform.LookAt(UnityEngine.Camera.main.transform);
                this.DelayAction(2.2f, () => PrefabFactory.Push("shockwave", shock));

                string     sfxName = Random.Range(0f, 1f) > 0.5 ? "sfxdeath1" : "sfxdeath2";
                GameObject sfx     = PrefabFactory.Pop(sfxName);
                sfx.transform.position = bullet.transform.position;
                this.DelayAction(4f, () => PrefabFactory.Push(sfxName, sfx));
            }

            PrefabFactory.Push("bullet", bullet.gameObject);
        }
Exemple #16
0
        private void CreateBossOne(int enemyBulletDelay, int scale = 1)
        {
            var xPosition = GameHelper.GetRelativeScaleX(0.5f);
            var enemy     = new GameObject("Boss", new Vector2(xPosition, 0))
            {
                Scale = scale
            };

            var shipTexture            = SpaceGraphics.BossAAsset.First();
            var enemySprite            = new SpriteComponent(shipTexture);
            var enemyMovement          = new MovementComponent(0.1f, FaceDirection.Down, new Vector2(0, 1));
            var enemyBullet            = new BulletComponent(TopDown.EnemyBulletName, SpaceGraphics.BulletAsset[0], enemyMovement);
            var enemyBoundary          = new BoundaryComponent(SpaceGraphics.BoundaryAsset.First(), shipTexture.Width, shipTexture.Height);
            var enemyTimed             = new TimedActionComponent(ObjectEvent.Fire, enemyBulletDelay);
            var enemyOutOfBounds       = new OutOfBoundsComponent(ObjectEvent.RemoveEntity);
            var healthCounterComponent = new CounterIncrementComponent(ObjectEvent.CollisionEnter, ObjectEvent.HealthRemoved, ObjectEvent.HealthEmpty, ObjectEvent.HealthReset, 5, 0);
            var healthBarComponent     = new SpriteRepeaterComponent(SpaceGraphics.HealthBarAsset[1], new Vector2(0, 25), false, ObjectEvent.HealthRemoved, healthCounterComponent);
            var deathAction            = new ObjectEventComponent(ObjectEvent.HealthEmpty, BossDeath);

            enemy.AddComponent(enemySprite);
            enemy.AddComponent(enemyMovement);
            enemy.AddComponent(enemyBullet);
            enemy.AddComponent(enemyBoundary);
            enemy.AddComponent(enemyOutOfBounds);
            enemy.AddComponent(enemyTimed);
            enemy.AddComponent(healthCounterComponent);
            enemy.AddComponent(healthBarComponent);
            enemy.AddComponent(deathAction);

            ForegroundLayer.AddGameObject(enemy);
        }
Exemple #17
0
 protected void InitBullet(BulletComponent bullet, Vector3 position, Vector3 direction, float radius, Rigidbody tankRigidbody)
 {
     position += direction * radius;
     position += ((direction * Vector3.Dot(direction, tankRigidbody.velocity.normalized)) * tankRigidbody.velocity.magnitude) * Time.smoothDeltaTime;
     bullet.LastUpdateTime = Time.time;
     bullet.Position       = position;
     bullet.Direction      = direction;
 }
Exemple #18
0
    IEnumerator WaitBeforeVFXEnded(BulletComponent bullet)
    {
        bullet.canCheck       = false;
        bullet.movingVelocity = Vector3.zero;
        yield return(new WaitForSeconds(0.6f));

        bullet.gameObject.SetActive(false);
    }
Exemple #19
0
        protected void SendBulletStaticHitEvent(Entity bulletEntity, BulletComponent bullet)
        {
            BulletStaticHitEvent eventInstance = new BulletStaticHitEvent {
                Position = bullet.Position
            };

            base.ScheduleEvent(eventInstance, bulletEntity);
        }
Exemple #20
0
        protected void MoveBullet(Entity bulletEntity, BulletComponent bullet)
        {
            float num  = Time.time - bullet.LastUpdateTime;
            float num2 = bullet.Speed * num;

            bullet.Position      += num2 * bullet.Direction;
            bullet.Distance      += num2;
            bullet.LastUpdateTime = Time.time;
        }
    void OnTriggerEnter(Collider other)
    {
        BulletComponent component = other.gameObject.GetComponent <BulletComponent>();

        if (component != null)
        {
            ApplyDamage(component.Damage);
        }
    }
Exemple #22
0
        protected void SendBulletTargetHitEvent(Entity bulletEntity, BulletComponent bullet, Entity target)
        {
            BulletTargetHitEvent eventInstance = new BulletTargetHitEvent {
                Position = bullet.Position,
                Target   = target
            };

            base.ScheduleEvent(eventInstance, bulletEntity);
        }
Exemple #23
0
        // This method is called in the handleFireWeapon method to create the bullet
        // that is fired from the entity. It will give the bullet all the necessary components.
        public void CreateBullet(InputEvent inputEvent, SpriteComponent bulletSpriteComponent, WeaponComponent weaponComponent, MoveComponent moveComponent, RenderComponent renderComponent, PositionComponent positionComponent)
        {
            // We create an new position instance for the bullet that starts from the player but should
            // not be the same as the players, as we found out when we did our test, otherwise the player
            // will follow the same way ass the bullet.
            var bulletPositionComponent = new PositionComponent()
            {
                Position = new Vector2(positionComponent.Position.X, positionComponent.Position.Y),
                ZIndex   = positionComponent.ZIndex
            };


            int bulletEntityId = EntityManager.GetEntityManager().NewEntity();

            var bulletRenderComponent = new RenderComponent()
            {
                DimensionsComponent = new DimensionsComponent()
                {
                    Height = 10,
                    Width  = 10
                }
            };
            var bulletMoveComponent = new MoveComponent()
            {
                AccelerationSpeed = 0,
                Speed             = 1000,
                MaxVelocitySpeed  = 1000,
                Direction         = moveComponent.Direction
            };
            var bulletComponent = new BulletComponent()
            {
                Damage          = weaponComponent.Damage,
                ShooterEntityId = inputEvent.EntityId
            };
            var bulletCollisionComponent = new CollisionComponent();
            var animationComponent       = new AnimationComponent();

            ComponentManager.AddComponentToEntity(bulletPositionComponent, bulletEntityId);
            ComponentManager.AddComponentToEntity(bulletComponent, bulletEntityId);
            ComponentManager.AddComponentToEntity(bulletSpriteComponent, bulletEntityId);
            ComponentManager.AddComponentToEntity(bulletMoveComponent, bulletEntityId);
            ComponentManager.AddComponentToEntity(bulletRenderComponent, bulletEntityId);
            ComponentManager.AddComponentToEntity(bulletCollisionComponent, bulletEntityId);
            ComponentManager.AddComponentToEntity(animationComponent, bulletEntityId);

            var animation = new GeneralAnimation()
            {
                AnimationType    = "BulletAnimation",
                StartOfAnimation = inputEvent.EventTime,
                Length           = 2000,
                Unique           = true
            };

            NewBulletAnimation(animation, bulletEntityId);
            animationComponent.Animations.Add(animation);
        }
    private int SortByTime(BulletComponent a, BulletComponent b)
    {
        float distA = Vector3.Distance(new Vector3(a.stats.position.x, a.stats.position.y, 0), p.transform.position);
        float distB = Vector3.Distance(new Vector3(b.stats.position.x, b.stats.position.y, 0), p.transform.position);

        float timeA = distA / a.stats.velocity;
        float timeB = distB / a.stats.velocity;

        return(timeA.CompareTo(timeB));
    }
Exemple #25
0
    private void Shoot()
    {
        GameObject      bulletGO = (GameObject)Instantiate(m_BulletPrefab, m_FirePoint.position, m_FirePoint.rotation);
        BulletComponent bullet   = bulletGO.GetComponent <BulletComponent> ();

        if (bullet != null)
        {
            bullet.Seek(m_Target);
        }
    }
        public void Move(UpdateEvent e, BulletEffectNode node)
        {
            GameObject effect = node.bulletEffectInstance.Effect;

            if (effect)
            {
                BulletComponent bullet = node.bullet;
                effect.transform.position = bullet.Position;
                effect.transform.rotation = Quaternion.LookRotation(bullet.Direction);
            }
        }
    public void UpdateSystem(BulletComponent bullet, RigidbodyComponent rigidbody)
    {
        bullet.timeAlive += Time.fixedDeltaTime;

        rigidbody.velocity = bullet.transform.up * bulletSpeed;

        if (bullet.timeAlive > bulletLife)
        {
            bullet.entity.Destroy();
        }
    }
    private bool FilterByThreat(BulletComponent a)
    {
        Vector3 dirToPlayer = p.transform.position - new Vector3(a.stats.position.x, a.stats.position.y, 0f);

        dirToPlayer.Normalize();

        Vector3 direction = new Vector3(a.stats.direction.x, a.stats.direction.y, 0f).normalized;

        float angleRad = Mathf.Acos(Vector3.Dot(dirToPlayer, direction));

        return(Mathf.Rad2Deg * angleRad < 3f);
    }
Exemple #29
0
        public void PrepareTargets(UpdateEvent e, BulletNode bulletNode, [JoinByTank] WeaponNode weaponNode)
        {
            BulletComponent bullet        = bulletNode.bullet;
            float           num           = UnityTime.time - bullet.LastUpdateTime;
            TargetingData   targetingData = BattleCache.targetingData.GetInstance().Init();

            targetingData.Origin       = bullet.Position - (bullet.Direction * 0.1f);
            targetingData.Dir          = bullet.Direction;
            targetingData.FullDistance = Math.Min(Math.Max((float)0f, (float)(bulletNode.bulletConfig.FullDistance - bullet.Distance)), bullet.Speed * num);
            base.ScheduleEvent(BattleCache.targetingEvent.GetInstance().Init(targetingData), bulletNode);
            base.ScheduleEvent(BattleCache.updateBulletEvent.GetInstance().Init(targetingData), bulletNode);
        }
    protected void _makeShot(TInstantiationCommand command)
    {
        BaseGunConfig gunConfigs = command.mGunConfigs;

        /// create a new instance of a bullet prefab
        GameObject bulletInstance = GameObject.Instantiate(gunConfigs.mBulletPrefab, command.mGunPosition, Quaternion.identity, mBulletsRootTransform);

        BulletComponent bulletComponent = bulletInstance.GetComponent <BulletComponent>();

        bulletComponent.mDamage         = gunConfigs.mDamage;
        bulletComponent.mSpeed          = gunConfigs.mBulletSpeed;
        bulletComponent.mTargetPosition = command.mEnemyTargetPosition;
    }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory = new AggregateFactory(this);
            WeaponFactory = new WeaponFactory(this);
            DoorFactory = new DoorFactory(this);
            RoomFactory = new RoomFactory(this);
            CollectableFactory = new CollectibleFactory(this);
            WallFactory = new WallFactory(this);
            EnemyFactory = new EnemyFactory(this);
            SkillEntityFactory = new SkillEntityFactory(this);
            NPCFactory = new NPCFactory(this);

            // Initialize Components
            PlayerComponent = new PlayerComponent();
            LocalComponent = new LocalComponent();
            RemoteComponent = new RemoteComponent();
            PositionComponent = new PositionComponent();
            MovementComponent = new MovementComponent();
            MovementSpriteComponent = new MovementSpriteComponent();
            SpriteComponent = new SpriteComponent();
            DoorComponent = new DoorComponent();
            RoomComponent = new RoomComponent();
            HUDSpriteComponent = new HUDSpriteComponent();
            HUDComponent = new HUDComponent();
            InventoryComponent = new InventoryComponent();
            InventorySpriteComponent = new InventorySpriteComponent();
            ContinueNewGameScreen = new ContinueNewGameScreen(graphics, this);
            EquipmentComponent = new EquipmentComponent();
            WeaponComponent = new WeaponComponent();
            BulletComponent = new BulletComponent();
            PlayerInfoComponent = new PlayerInfoComponent();
            WeaponSpriteComponent = new WeaponSpriteComponent();
            StatsComponent = new StatsComponent();
            EnemyAIComponent = new EnemyAIComponent();
            NpcAIComponent = new NpcAIComponent();

            CollectibleComponent = new CollectibleComponent();
            CollisionComponent = new CollisionComponent();
            TriggerComponent = new TriggerComponent();
            EnemyComponent = new EnemyComponent();
            NPCComponent = new NPCComponent();
            //QuestComponent = new QuestComponent();
            LevelManager = new LevelManager(this);
            SpriteAnimationComponent = new SpriteAnimationComponent();
            SkillProjectileComponent = new SkillProjectileComponent();
            SkillAoEComponent = new SkillAoEComponent();
            SkillDeployableComponent = new SkillDeployableComponent();
            SoundComponent = new SoundComponent();
            ActorTextComponent = new ActorTextComponent();
            TurretComponent = new TurretComponent();
            TrapComponent = new TrapComponent();
            ExplodingDroidComponent = new ExplodingDroidComponent();
            HealingStationComponent = new HealingStationComponent();
            PortableShieldComponent = new PortableShieldComponent();
            PortableStoreComponent = new PortableStoreComponent();
            ActiveSkillComponent = new ActiveSkillComponent();
            PlayerSkillInfoComponent = new PlayerSkillInfoComponent();

            Quests = new List<Quest>();

            #region Initialize Effect Components
            AgroDropComponent = new AgroDropComponent();
            AgroGainComponent = new AgroGainComponent();
            BuffComponent = new BuffComponent();
            ChanceToSucceedComponent = new ChanceToSucceedComponent();
            ChangeVisibilityComponent = new ChangeVisibilityComponent();
            CoolDownComponent = new CoolDownComponent();
            DamageOverTimeComponent = new DamageOverTimeComponent();
            DirectDamageComponent = new DirectDamageComponent();
            DirectHealComponent = new DirectHealComponent();
            FearComponent = new FearComponent();
            HealOverTimeComponent = new HealOverTimeComponent();
            InstantEffectComponent = new InstantEffectComponent();
            KnockBackComponent = new KnockBackComponent();
            TargetedKnockBackComponent = new TargetedKnockBackComponent();
            ReduceAgroRangeComponent = new ReduceAgroRangeComponent();
            ResurrectComponent = new ResurrectComponent();
            StunComponent = new StunComponent();
            TimedEffectComponent = new TimedEffectComponent();
            EnslaveComponent = new EnslaveComponent();
            CloakComponent = new CloakComponent();
            #endregion

            base.Initialize();
        }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            AggregateFactory = new AggregateFactory(this);
            WeaponFactory = new WeaponFactory(this);
            DoorFactory = new DoorFactory(this);
            RoomFactory = new RoomFactory(this);
            CollectableFactory = new CollectibleFactory(this);
            WallFactory = new WallFactory(this);
            EnemyFactory = new EnemyFactory(this);

            // Initialize Components
            PlayerComponent = new PlayerComponent();
            LocalComponent = new LocalComponent();
            RemoteComponent = new RemoteComponent();
            PositionComponent = new PositionComponent();
            MovementComponent = new MovementComponent();
            MovementSpriteComponent = new MovementSpriteComponent();
            SpriteComponent = new SpriteComponent();
            DoorComponent = new DoorComponent();
            RoomComponent = new RoomComponent();
            HUDSpriteComponent = new HUDSpriteComponent();
            HUDComponent = new HUDComponent();
            InventoryComponent = new InventoryComponent();
            InventorySpriteComponent = new InventorySpriteComponent();
            ContinueNewGameScreen = new ContinueNewGameScreen(graphics, this);
            EquipmentComponent = new EquipmentComponent();
            WeaponComponent = new WeaponComponent();
            BulletComponent = new BulletComponent();
            PlayerInfoComponent = new PlayerInfoComponent();
            WeaponSpriteComponent = new WeaponSpriteComponent();
            StatsComponent = new StatsComponent();
            EnemyAIComponent = new EnemyAIComponent();
            CollectibleComponent = new CollectibleComponent();
            CollisionComponent = new CollisionComponent();
            TriggerComponent = new TriggerComponent();
            EnemyComponent = new EnemyComponent();
            QuestComponent = new QuestComponent();
            LevelManager = new LevelManager(this);
            SpriteAnimationComponent = new SpriteAnimationComponent();
            SkillProjectileComponent = new SkillProjectileComponent();
            SkillAoEComponent = new SkillAoEComponent();
            SkillDeployableComponent = new SkillDeployableComponent();

            //TurretComponent = new TurretComponent();
            //TrapComponent = new TrapComponent();
            //PortableShopComponent = new PortableShopComponent();
            //PortableShieldComponent = new PortableShieldComponent();
            //MotivateComponent =  new MotivateComponent();
            //FallbackComponent = new FallbackComponent();
            //ChargeComponent = new ChargeComponent();
            //HealingStationComponent = new HealingStationComponent();
            //ExplodingDroidComponent = new ExplodingDroidComponent();

            base.Initialize();
        }