예제 #1
0
        public HealthClock(AttributePair health, AttributePair shield, Vector2 position, ContentManager content)
        {
            _health = health;
            _shield = shield;
            _position = position;

            _healthClock_Back = content.Load<Texture2D>(@"Gui/HealthClock_Back");
            _healthClock_Center = content.Load<Texture2D>(@"Gui/HealthClock_Center");
            _healthClock_HeartHand = content.Load<Texture2D>(@"Gui/HealthClock_HeartHand");
            _healthClock_ShieldHand = content.Load<Texture2D>(@"Gui/HealthClock_ShieldHand");

            _heartRotationOrigin = new Vector2(_healthClock_HeartHand.Width / 2, _healthClock_HeartHand.Height / 2);
            _shieldRotationOrigin = new Vector2(_healthClock_ShieldHand.Width / 2, _healthClock_ShieldHand.Height / 2);

            _heartRotation = 0f;

            _maxWaitTime = 20;
            _currentTime = _maxWaitTime;

            _currentHeartAngle = -2f * (float)Math.PI;
            _currentShieldAngle = -2f * (float)Math.PI;

            _alpha = 1.0f;

            Bounds = new Rectangle(
                (int)_position.X,
                (int)_position.Y,
                (int)(_healthClock_Back.Width * SCALE),
                (int)(_healthClock_Back.Height * SCALE));
        }
예제 #2
0
        public Entity(World world)
        {
            _world = world;

            _xVelocityLimit = new Vector2(Int32.MinValue, Int32.MaxValue);
            _yVelocityLimit = new Vector2(Int32.MinValue, Int32.MaxValue);

            _animatedSprite = new Dictionary<String, AnimatedSprite>();
            _currentSpriteKey = String.Empty;

            _leftCollisionOffset = 0;
            _rightCollisionOffset = 0;
            _topCollisionOffset = 0;
            _bottomCollisionOffset = 0;

            _isAlive = true;

            //TODO: Temp Health, need to allow health to be set for individual enemies
            _health = new AttributePair(600);
            _shield = new AttributePair(300);
            _tintColor = Color.White;
        }
예제 #3
0
        public Player(World world, Texture2D texture, Texture2D attackTexture)
            : base(world)
        {
            AttackTranslation = new Vector2(-64, -64);
            _currentTranslation = Vector2.Zero;

            int spriteWidth = 128;
            int spriteHeight = 128;
            int frameCount = 4;

            Dictionary<AnimationKey, Animation> animations = new Dictionary<AnimationKey, Animation>();

            Animation animation = new Animation(frameCount, spriteWidth, spriteHeight, 0, 0);
            animations.Add(AnimationKey.Down, animation);

            animation = new Animation(frameCount, spriteWidth, spriteHeight, 0, spriteHeight);
            animations.Add(AnimationKey.Left, animation);

            animation = new Animation(frameCount, spriteWidth, spriteHeight, 0, spriteHeight * 2);
            animations.Add(AnimationKey.Right, animation);

            animation = new Animation(frameCount, spriteWidth, spriteHeight, 0, spriteHeight * 3);
            animations.Add(AnimationKey.Up, animation);

            AnimatedSprite sprite = new AnimatedSprite(
                texture,
                animations,
                Color.White);

            AnimatedSprites.Add("Normal", sprite);

            spriteWidth = 256;
            spriteHeight = 256;

            animations = new Dictionary<AnimationKey, Animation>();

            animation = new Animation(frameCount, spriteWidth, spriteHeight, 0, 0, false);
            animation.FramesPerSecond = 10;

            animations.Add(AnimationKey.Down, animation);

            animation = new Animation(frameCount, spriteWidth, spriteHeight, 0, spriteHeight, false);
            animation.FramesPerSecond = 10;

            animations.Add(AnimationKey.Right, animation);

            animation = new Animation(frameCount, spriteWidth, spriteHeight, 0, spriteHeight * 2, false);
            animation.FramesPerSecond = 10;

            animations.Add(AnimationKey.Left, animation);

            animation = new Animation(frameCount, spriteWidth, spriteHeight, 0, spriteHeight * 3, false);
            animation.FramesPerSecond = 10;

            animations.Add(AnimationKey.Up, animation);

            sprite = new AnimatedSprite(
                attackTexture,
                animations,
                Color.White);

            AnimatedSprites.Add("Attack", sprite);

            _health = new AttributePair(400);
            _shield = new AttributePair(200);

            Rectangle windowBounds = World.Game.Window.ClientBounds;
            _inventory = new InventoryManager(World.Game.Content, new Vector2(10, windowBounds.Height - 70));
            _velocity = new Vector2(3, 3);

            this.XCollisionOffset = 30;
            this.TopCollisionOffset = (int)(CurrentSprite.Height / 2);

            _healthClock = new HealthClock(_health, _shield, new Vector2(10, 10), World.Game.Content);
        }