Пример #1
0
        public Tank(Texture2D tbt, Texture2D tct, Texture2D tbtr)
        {
            health = new UI.HealthBar(50, 50);
            health.Scale = .6f;
            tank_body_texture = tbt;
            tank_cannon_texture = tct;
            tank_body_texture_right = tbtr;
            tank_body_to_draw = tank_body_texture;

            Position = new Vector2(300, 400);
            Orientation = SpriteEffects.None;

            debug_overlay = new RectangleOverlay(CollisionRect, Color.Green, Arena.Screens.TankShooters.gDevice);

            tank_dust_effect = ArenaParticleEngine.ParticleEngine.Instance.LoadFromFile("TankDustEffect", Arena.Screens.TankShooters.content);
        }
Пример #2
0
        protected virtual void Load(Core.Transform transform)
        {
            // Physics
            AddComponent(new Body(this));
            AddComponent(new CircleCollider(this, CollisionChanell.Enemy, colliderOffset, colliderRadius));

            // HealthBar
            healthComponent           = AddComponent(new Gameplay.Health(this));
            healthComponent.MaxHealth = maxHealth;
            healthBar = AddComponent(new UI.HealthBar(this, healthBarOffset));
            healthComponent.OnDamageTaken += healthBar.Refresh;
            healthComponent.OnDamageTaken += OnDamage;
            healthComponent.OnDepleted    += Die;

            // AI
            aiAttack   = AddComponent(new Gameplay.AIAttack(this));
            movement   = AddComponent(new Navigation.MovementComponent(this));
            navigation = AddComponent(new Navigation.NavigationAgent(this));

            // Visual
            anim = AddComponent(new Graphics.StackAnimator(this));
        }