Esempio n. 1
0
            protected override void OnTick()
            {
                Map map = m_Egg.Map;

                if (map == null)
                {
                    return;
                }

                CamelSpiderHatchling spawned = new CamelSpiderHatchling();

                bool    validLocation = false;
                Point3D loc           = m_Egg.Location;

                for (int j = 0; !validLocation && j < 10; ++j)
                {
                    int x = loc.X + Utility.Random(3) - 1;
                    int y = loc.Y + Utility.Random(3) - 1;
                    int z = map.GetAverageZ(x, y);

                    if (validLocation = map.CanFit(x, y, loc.Z, 16, false, false))
                    {
                        loc = new Point3D(x, y, loc.Z);
                    }
                    else if (validLocation = map.CanFit(x, y, z, 16, false, false))
                    {
                        loc = new Point3D(x, y, z);
                    }
                }

                spawned.MoveToWorld(loc, map);

                Stop();
                m_Egg.Delete();
            }
Esempio n. 2
0
			protected override void OnTick()
			{
				Map map = m_Egg.Map;

				if ( map == null )
					return;

				CamelSpiderHatchling spawned = new CamelSpiderHatchling();

				bool validLocation = false;
				Point3D loc = m_Egg.Location;

				for ( int j = 0; !validLocation && j < 10; ++j )
				{
					int x = loc.X + Utility.Random( 3 ) - 1;
					int y = loc.Y + Utility.Random( 3 ) - 1;
					int z = map.GetAverageZ( x, y );

					if ( validLocation = map.CanFit( x, y, loc.Z, 16, false, false ) )
						loc = new Point3D( x, y, loc.Z );
					else if ( validLocation = map.CanFit( x, y, z, 16, false, false ) )
						loc = new Point3D( x, y, z );
				}

				spawned.MoveToWorld( loc, map );

				Stop();
				m_Egg.Delete();
			}