Пример #1
0
        private void ThrowSword()
        {
            IAttack swordBeam = new SwordBeam(Game, Self, Self.Direction);

            if (Math.Abs(Self.Position.X - Game.Link.Position.X) < 8)
            {
                if (Game.Link.Position.Y < Self.Position.Y && Self.Direction == States.Direction.Up)
                {
                    AttackTimer = 0;
                    swordBeam.Attack();
                }
                else if (Game.Link.Position.Y > Self.Position.Y && Self.Direction == States.Direction.Down)
                {
                    AttackTimer = 0;
                    swordBeam.Attack();
                }
            }
            if (Math.Abs(Self.Position.Y - Game.Link.Position.Y) < 8)
            {
                if (Game.Link.Position.X < Self.Position.X && Self.Direction == States.Direction.Left)
                {
                    AttackTimer = 0;
                    swordBeam.Attack();
                }
                else if (Game.Link.Position.X > Self.Position.X && Self.Direction == States.Direction.Right)
                {
                    AttackTimer = 0;
                    swordBeam.Attack();
                }
            }
        }
Пример #2
0
        /*
         * addes sound Effects
         * 0.LOZ_Arrow_Boomerang
         * 1 LOZ_Bomb_Blow
         * 2 LOZ_Bomb_Drop
         * 3 LOZ_Boss_Scream1
         * 4 LOZ_Candle
         * 5 LOZ_Door_Unlock
         * 6 LOZ_Enemy_Die
         * 7 LOZ_Enemy_Hit
         * 8 LOZ_Fanfare
         * 9 LOZ_Get_Heart
         * 10 LOZ_Get_Item
         * 11 LOZ_Get_Rupee
         * 12 LOZ_Key_Appear
         * 13 LOZ_Link_Die
         * 14 LOZ_Link_Hurt
         * 15 LOZ_Secret
         * 16 LOZ_Stairs
         * 17 LOZ_Sword_Shoot
         * 18 LOZ_Sword_Slash
         */

        public void Update()
        {
            Hitbox = new Rectangle((int)Position.X + 2, (int)Position.Y + 4, (int)Sprite.Size.X - 4, (int)Sprite.Size.Y - 4);
            Timer++;
            if (Timer == SwordStartTime)
            {
                SwordAttack.Attack();
                Game.soundEffects[18].Play();
            }
            else if (Timer >= AttackDuration)
            {
                if (HP == MaxHP)
                {
                    IAttack swordBeam = new SwordBeam(Game, decoratedLink, Direction);
                    swordBeam.Attack();
                    Game.soundEffects[17].Play();
                }
                RemoveDecorator();
            }
        }