Ejemplo n.º 1
0
        public override void OnActivate(GameTime gameTime, ArmorPotionFramework.EntityClasses.Player activatedBy)
        {
            if (!_hasProjectile)
            {
                AreaOfEffectProjectile projectile = new AreaOfEffectProjectile(activatedBy.World, this, ProjectileTarget.Enemy, ArmorPotionFramework.TileEngine.EventType.LightningEvent, false, CenterEntity(activatedBy), 3000);
                projectile.AnimatedSprites.Add("Normal", AnimatedSprite);

                activatedBy.World.Projectiles.Add(projectile);

                _hasProjectile = true;
            }
        }
Ejemplo n.º 2
0
        public void Update(Microsoft.Xna.Framework.GameTime gameTime, ArmorPotionFramework.EntityClasses.Enemy enemy)
        {
            bool canAttack = WaitTimer(gameTime);
            if (canAttack && !_isSetUp)
            {
                Vector2 newPosition = new Vector2(enemy.Position.X - enemy.CurrentSprite.Width / 2, enemy.Position.Y - enemy.CurrentSprite.Height / 2);

                Animation animation = new Animation(1, 256, 256, 0, 0);
                _projectile = new AreaOfEffectProjectile(enemy.World, null, ProjectileTarget.Player, EventType.LightningEvent, false, newPosition, _defaultLifetime);
                _projectile.AnimatedSprites.Add("Normal", _sprite.Clone());
                _projectile.DamageAmount = _aoeDamage;

                enemy.World.Projectiles.Add(_projectile);
                _lifetime = _defaultLifetime;
                _isSetUp = true;
                enemy.CurrentSpriteKey = "Walking";
            }
            else if(canAttack && _isSetUp)
            {
                _lifetime -= gameTime.ElapsedGameTime.Milliseconds;
                if (_lifetime < 0)
                {
                    _isSetUp = false;
                    enemy.ActionComplete();
                }
            }
        }
Ejemplo n.º 3
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (!_thrown)
            {
                double distance = GameMath.Distance(_startingPosition, _position);
                _position += Velocity;
                if (distance > _throwDistance)
                    _thrown = true;
            }
            else
            {
                if (_eventType == EventType.FireEvent || _eventType == EventType.IceEvent)
                {
                    if (_angle < _beginningAngle + _angleCycle)
                    {
                        double newAngle = _angle += _deltaAngle;

                        if (_eventType == EventType.IceEvent)
                            newAngle = RandomGenerator.Random.NextDouble() * Math.PI * 2;

                        ConeProjectile projectile = new ConeProjectile(World, null, this._target, _eventType, _triggerSecondaryProjectileEvents, _projectileDistance, _position, newAngle, _projectileSpread);
                        projectile.DamageAmount = this.DamageAmount;

                        projectile.AnimatedSprites.Add("Normal", AnimatedSprites["Projectile"].Clone());

                        World.ProjectilesToAdd.Add(projectile);
                    }
                    else
                    {
                        this._isAlive = false;
                    }
                }
                else if (_eventType == EventType.LightningEvent)
                {
                    AreaOfEffectProjectile projectile = new AreaOfEffectProjectile(
                        World,
                        null,
                        this._target,
                        _eventType,
                        _triggerSecondaryProjectileEvents,
                        new Vector2(_position.X - AnimatedSprites["Projectile"].Width / 2, _position.Y - AnimatedSprites["Projectile"].Height / 2),
                        _aoeLife);

                    projectile.AnimatedSprites.Add("Normal", AnimatedSprites["Projectile"].Clone());

                    World.ProjectilesToAdd.Add(projectile);

                    this._isAlive = false;
                }
            }
        }