Esempio n. 1
0
        public RollingCircleEnemy(Engine engine, Vector2 position)
            : base(engine, position)
        {
            animation = new Animation(engine, @"Characters\FlickeringCircle", 64, 64, 1, 2, 2, 15, Global.Animations.Repeat);
            animation.Play();

            enemyPhysicsComponent = new EnemyPhysicsComponent(Engine, position, Global.Shapes.Circle);
            enemyPhysicsComponent.MainFixture.Body.LinearDamping = 2.0f;
            enemyPhysicsComponent.MainFixture.CollisionFilter.CollisionCategories = (Category)Global.CollisionCategories.Enemy;
            enemyPhysicsComponent.MainFixture.OnCollision += EnemyOnCollision;

            deathAnimation = new Animation(engine, @"Miscellaneous\Explosion", 512, 512, 3, 4, 9, 20, Global.Animations.PlayOnce);
            deathAnimation.Scale = 0.3f;
            deathAnimation.DrawOrder = int.MaxValue - 1;

            enemySound = Engine.Audio.GetCue("EnterTheVoid");

            light = new Light(engine);
            light.Color = Color.White;
            light.Fov = MathHelper.TwoPi;
            light.Position = position;
            light.Range = 100;

            engine.AddComponent(this);
        }
Esempio n. 2
0
        public FlyingBoxEnemy(Engine engine, Vector2 position)
            : base(engine, position)
        {
            animation = new Animation(engine, @"Characters\GrayRotatingBox", 128, 128, 4, 4, 16, 9, Global.Animations.Repeat);
            animation.DrawOrder = (int)Global.Layers.AboveLighting;
            animation.Play();

            enemyPhysicsComponent = new EnemyPhysicsComponent(Engine, position, Global.Shapes.Square);
            enemyPhysicsComponent.MainFixture.Body.LinearDamping = 2.0f;
            enemyPhysicsComponent.MainFixture.CollisionFilter.CollisionCategories = (Category)Global.CollisionCategories.Enemy;
            enemyPhysicsComponent.MainFixture.OnCollision += EnemyOnCollision;

            deathAnimation = new Animation(engine, @"Miscellaneous\Explosion", 512, 512, 3, 4, 9, 20, Global.Animations.PlayOnce);
            deathAnimation.DrawOrder = int.MaxValue - 1;
            deathAnimation.Scale = 0.3f;

            attacking = false;

            enemySound = Engine.Audio.GetCue("WeirdHoverSound");

            engine.AddComponent(this);
        }