예제 #1
0
파일: Bullet.cs 프로젝트: Amoel/Evershock
        //---------------------------------------------------------------------------

        public Bullet(string name, Guid parent) : base(name, parent)
        {
            AddComponent <TransformComponent>();
            AddComponent <BulletPhysicsComponent>();
            AddComponent <SpriteComponent>().Init(AssetManager.Get().Find <Texture2D>(ESpriteAssets.RedOrb));
            AddComponent <LightingComponent>().Init(AssetManager.Get().Find <Texture2D>(ESpriteAssets.RedOrb), Vector2.Zero, Vector2.One * 2, Color.White, 0.5f);

            CircleColliderComponent collider = AddComponent <CircleColliderComponent>();

            collider.Init(4, BodyType.Dynamic);
            collider.SetSensor(true);
            collider.SetCollisionCategory(ECollisionCategory.Bullet);
            collider.SetCollidesWith(ECollisionCategory.Stage);
            collider.Enter += OnHit;

            AddComponent <DespawnComponent>();
        }