public PlayerBullet()
        {
            SpriteComponent spriteComponent = new SpriteComponent(this);

            spriteComponent.Image = Resources.PlayerBullet;
            AddComponent(spriteComponent);

            BoxCollider boxCollider = new BoxCollider(this);

            boxCollider.Size = spriteComponent.Image.Size;
            AddComponent(boxCollider);

            ScrollingComponent scrolling = new ScrollingComponent(this);

            scrolling.Speed        = 200f;
            scrolling.ScrollY      = true;
            scrolling.YAddNegative = true;
            AddComponent(scrolling);

            LimitLocationDelete limit = new LimitLocationDelete(this);

            AddComponent(limit);

            DamageSystem damageSystem = new DamageSystem(this);

            damageSystem.HitAbleTag = "Enemy";
            AddComponent(damageSystem);
        }
Example #2
0
        public EnemyBullet()
        {
            transform.Rotation = 180;

            SpriteComponent spriteComponent = new SpriteComponent(this);

            spriteComponent.Image = Resources.EnemyBullet;
            AddComponent(spriteComponent);

            BoxCollider boxCollider = new BoxCollider(this);
            Size        boxSize     = new Size();

            boxSize.Width    = 3;
            boxSize.Height   = 8;
            boxCollider.Size = boxSize;
            AddComponent(boxCollider);

            TargetScrolling scrolling = new TargetScrolling(this);

            scrolling.Speed = 150f;
            var component = GameObject.FindObjectOfType <BulletShooter>();

            if (component != null)
            {
                scrolling.Destination = component.gameObject.transform.position;
            }
            AddComponent(scrolling);

            LimitLocationDelete limit = new LimitLocationDelete(this);

            AddComponent(limit);

            DamageSystem damageSystem = new DamageSystem(this);

            damageSystem.HitAbleTag = "Player";
            AddComponent(damageSystem);
        }