Пример #1
0
		public static void Flying( BaseCreature fbc )
		{
			if ( NullCheck( fbc ))
				return;

			if ( CheckAbove( fbc ))
			{
				fbc.IsFlying = false;
				fbc.IsTakingOff = false;
				return;
			}

			Timer f_timer = new FlyingTimer( fbc );

			CheckMethods( fbc );

			if ( fbc.CanFly == false )
				return;

			if ( fbc.FlyStam <= 50 )
			{
				fbc.FlyingUp = false;
				fbc.IsLanding = true;
				fbc.FlyingDown = true;
			}

			if ( (fbc.Z + 20) >= fbc.Ceiling )
			{
				fbc.FlyingUp = false;
				fbc.FlyingDown = true;
				fbc.Z--;
			}

			if ( fbc.FlyingUp == true )
				fbc.Z++;
			if ( fbc.FlyingDown == true )
				fbc.Z--;

			CheckMethods( fbc );

			int direct = Utility.Random( 1, 20 );
			int altitude = Utility.Random( 1, 3 );

			if ( fbc.IsTakingOff == true )
			{
				TakeOff( fbc );
 
				if ( direct == 7 )
					RandomChangeDirection( fbc ); 
				MaskedDirection( fbc );

				CheckMethods( fbc );

    				f_timer.Start();

				if ( fbc.FlyAnim == 2 )
    					AnimateFlying( fbc );

				if ( fbc.FlyStam > 10 )
					fbc.FlyStam--;
				return;
			}

			if ( fbc.IsLanding == true )
			{
				Landing( fbc );

				if ( fbc.IsLanding == false )
					return;

				if ( direct == 7 )
					RandomChangeDirection( fbc );
				MaskedDirection( fbc );

				CheckMethods( fbc );

				f_timer.Start();

				if ( fbc.FlyAnim == 2 )
    					AnimateFlying( fbc );	
				return;
			}

			if ( (fbc.Z - 20) <= fbc.Ground )
			{
				fbc.FlyingUp = true;
				fbc.FlyingDown = false;
				fbc.Z++;
			}
			
			if ( direct == 7 )
				RandomChangeDirection( fbc ); 
			if ( altitude == 2 )
				RandomAltitudeDirection( fbc ); 
			MaskedDirection( fbc );

			CheckMethods( fbc );
                         
			f_timer.Start();

			if ( fbc.FlyAnim == 2 )
    				AnimateFlying( fbc );	
		}
Пример #2
0
        public static void Flying(BaseCreature fbc)
        {
            if (NullCheck(fbc))
            {
                return;
            }

            if (CheckAbove(fbc))
            {
                fbc.IsFlying    = false;
                fbc.IsTakingOff = false;
                return;
            }

            Timer f_timer = new FlyingTimer(fbc);

            CheckMethods(fbc);

            if (fbc.CanFly == false)
            {
                return;
            }

            if (fbc.FlyStam <= 50)
            {
                fbc.FlyingUp   = false;
                fbc.IsLanding  = true;
                fbc.FlyingDown = true;
            }

            if ((fbc.Z + 20) >= fbc.Ceiling)
            {
                fbc.FlyingUp   = false;
                fbc.FlyingDown = true;
                fbc.Z--;
            }

            if (fbc.FlyingUp == true)
            {
                fbc.Z++;
            }
            if (fbc.FlyingDown == true)
            {
                fbc.Z--;
            }

            CheckMethods(fbc);

            int direct   = Utility.Random(1, 20);
            int altitude = Utility.Random(1, 3);

            if (fbc.IsTakingOff == true)
            {
                TakeOff(fbc);

                if (direct == 7)
                {
                    RandomChangeDirection(fbc);
                }
                MaskedDirection(fbc);

                CheckMethods(fbc);

                f_timer.Start();

                if (fbc.FlyAnim == 2)
                {
                    AnimateFlying(fbc);
                }

                if (fbc.FlyStam > 10)
                {
                    fbc.FlyStam--;
                }
                return;
            }

            if (fbc.IsLanding == true)
            {
                Landing(fbc);

                if (fbc.IsLanding == false)
                {
                    return;
                }

                if (direct == 7)
                {
                    RandomChangeDirection(fbc);
                }
                MaskedDirection(fbc);

                CheckMethods(fbc);

                f_timer.Start();

                if (fbc.FlyAnim == 2)
                {
                    AnimateFlying(fbc);
                }
                return;
            }

            if ((fbc.Z - 20) <= fbc.Ground)
            {
                fbc.FlyingUp   = true;
                fbc.FlyingDown = false;
                fbc.Z++;
            }

            if (direct == 7)
            {
                RandomChangeDirection(fbc);
            }
            if (altitude == 2)
            {
                RandomAltitudeDirection(fbc);
            }
            MaskedDirection(fbc);

            CheckMethods(fbc);

            f_timer.Start();

            if (fbc.FlyAnim == 2)
            {
                AnimateFlying(fbc);
            }
        }