当前位置: 首页>>代码示例>>C#>>正文


C# Items.WayPoint类代码示例

本文整理汇总了C#中Server.Items.WayPoint的典型用法代码示例。如果您正苦于以下问题:C# WayPoint类的具体用法?C# WayPoint怎么用?C# WayPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WayPoint类属于Server.Items命名空间,在下文中一共展示了WayPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WayPoint

 public WayPoint( WayPoint prev )
     : this()
 {
     if ( prev != null )
     {
         prev.NextPoint = this;
     }
 }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:8,代码来源:Waypoint.cs

示例2: Deserialize

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch( version )
			{
				case 0:
				{
					m_Next = reader.ReadItem() as WayPoint;
					break;
				}
			}
		}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:15,代码来源:Waypoint.cs

示例3: GoTo

		/// <summary>
		/// Moves the NPC to the specified location
		/// </summary>
		/// <param name="to">The location the NPC should move to</param>
		public void GoTo( Point2D to )
		{
			AI = AIType.AI_Melee;

			m_NextMove = new Point3D( to, Z );

			if ( m_Piece is Knight )
			{
				WayPoint end = new WayPoint();
				WayPoint start = new WayPoint();

				end.MoveToWorld( m_NextMove, Map );

				// This is a knight, so do L shaped move
				int dx = to.X - X;
				int dy = to.Y - Y;

				Point3D p = Location; // Point3D is a value type

				if ( Math.Abs( dx ) == 1 )
					p.X += dx;
				else
					p.Y += dy;

				start.MoveToWorld( p, Map );
				start.NextPoint = end;

				CurrentWayPoint = start;

				m_WayPoints.Add( start );
				m_WayPoints.Add( end );
			}
			else
			{
				WayPoint wp = new WayPoint();
				wp.MoveToWorld( m_NextMove, Map );
				CurrentWayPoint = wp;

				m_WayPoints.Add( wp );
			}

			Paralyzed = false;
		}
开发者ID:ITLongwell,项目名称:aedilis2server,代码行数:47,代码来源:ChessMobile.cs

示例4: DeplacerMobile

        public static void DeplacerMobile(Mobile m, Point3D p)
        {
            if (m == null) return;
            BaseCreature b = null;
            if(m is BaseCreature) b = (BaseCreature)m;
            if (b == null) return;

            if (b.AI == AIType.AI_None) b.AI = AIType.AI_Melee;

            if (b.CurrentWayPoint != null && b.CurrentWayPoint.Name == "TmpPoint")
                b.CurrentWayPoint.Delete();

            b.CurrentSpeed = 0.2;

            WayPoint point = new WayPoint();
            point.Name = "TmpPoint";
            point.MoveToWorld(p, b.Map);
            point.NextPoint = point;
            b.CurrentWayPoint = point;
        }
开发者ID:greeduomacro,项目名称:vivre-uo,代码行数:20,代码来源:NPChat.cs

示例5: OnTarget

        protected override void OnTarget( Mobile from, object targeted )
        {
            IPoint3D t = targeted as IPoint3D;
            if( t == null )
                return;

            Point3D loc = new Point3D( t );

            m_Man.AI = AIType.AI_Melee;
            m_Man.m_NextMove = loc;

            WayPoint GoHere = new WayPoint();
            GoHere.Map = from.Map;
            GoHere.Location = loc;
            m_Man.CurrentWayPoint = GoHere;
            m_Man.CantWalk = false;
            m_Man.Say( "I will gladly move here for you Master" );
            m_Man.m_WayPoints.Add( GoHere );
            from.SendGump( new MannequinControl( m_Man, from, 1 ) );
        }
开发者ID:Ziden,项目名称:ServUO-EC-Test-Fork,代码行数:20,代码来源:MannequinTarget.cs

示例6: Deserialize

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
                case 2:
				case 1:
				{
					key_KeyVal = reader.ReadUInt();
					key_Description = reader.ReadString();
					key_Max = reader.ReadInt();
					key_Delay = TimeSpan.Parse(reader.ReadString());
					i_Door = reader.ReadItem();

					goto case 0;
				}
				case 0:
				{
                    m_WalkingRange = reader.ReadInt();
					m_WayPoint = reader.ReadItem() as WayPoint;
					m_MinDelay = reader.ReadTimeSpan();
					m_MaxDelay = reader.ReadTimeSpan();
					m_Count = reader.ReadInt();
					m_Team = reader.ReadInt();
					m_HomeRange = reader.ReadInt();
					m_Running = reader.ReadBool();

                    if (version == 1)
                        m_WalkingRange = m_HomeRange;

					TimeSpan ts = TimeSpan.Zero;

					if ( m_Running )
						ts = reader.ReadDeltaTime() - DateTime.Now;
					
					int size = reader.ReadInt();

					m_CreaturesName = new ArrayList( size );

					for ( int i = 0; i < size; ++i )
					{
						string typeName = reader.ReadString();

						m_CreaturesName.Add( typeName );

						if ( SpawnerType.GetType( typeName ) == null )
						{
							if ( m_WarnTimer == null )
								m_WarnTimer = new gWarnTimer();

							m_WarnTimer.Add( Location, Map, typeName );
						}
					}

					int count = reader.ReadInt();

					m_Creatures = new ArrayList( count );

					for ( int i = 0; i < count; ++i )
					{
						IEntity e = World.FindEntity( reader.ReadInt() );

						if ( e != null )
							m_Creatures.Add( e );
					}

					if ( m_Running )
						DoTimer( ts );

					break;
				}
			}
		}
开发者ID:greeduomacro,项目名称:cov-shard-svn-1,代码行数:76,代码来源:GuardSpawner.cs

示例7: Deserialize


//.........这里部分代码省略.........

                m_dMinTameSkill = reader.ReadDouble();

                if ( version < 9 )
                    reader.ReadDouble();

                m_bTamable = reader.ReadBool();
                m_bSummoned = reader.ReadBool();

                if ( m_bSummoned )
                {
                    m_SummonEnd = reader.ReadDeltaTime();
                    new UnsummonTimer( m_ControlMaster, this, m_SummonEnd - DateTime.Now ).Start();
                }

                m_iControlSlots = reader.ReadInt();
            }
            else
            {
                m_FightMode = FightMode.Closest;

                m_bControled = false;
                m_ControlMaster = null;
                m_ControlTarget = null;
                m_ControlOrder = OrderType.None;
            }

            if ( version >= 3 )
                m_Loyalty = (PetLoyalty)reader.ReadInt();
            else
                m_Loyalty = PetLoyalty.WonderfullyHappy;

            if ( version >= 4 )
                m_CurrentWayPoint = reader.ReadItem() as WayPoint;

            if ( version >= 5 )
                m_SummonMaster = reader.ReadMobile();

            if ( version >= 6 )
            {
                m_HitsMax = reader.ReadInt();
                m_StamMax = reader.ReadInt();
                m_ManaMax = reader.ReadInt();
                m_DamageMin = reader.ReadInt();
                m_DamageMax = reader.ReadInt();
            }

            if ( version >= 7 )
            {
                m_PhysicalResistance = reader.ReadInt();
                m_PhysicalDamage = reader.ReadInt();

                m_FireResistance = reader.ReadInt();
                m_FireDamage = reader.ReadInt();

                m_ColdResistance = reader.ReadInt();
                m_ColdDamage = reader.ReadInt();

                m_PoisonResistance = reader.ReadInt();
                m_PoisonDamage = reader.ReadInt();

                m_EnergyResistance = reader.ReadInt();
                m_EnergyDamage = reader.ReadInt();
            }

            if ( version >= 8 )
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:67,代码来源:BaseCreature.cs

示例8: Deserialize

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 4:
                    {
                        m_WalkingRange = reader.ReadInt();

                        goto case 3;
                    }
                case 3:
                case 2:
                    {
                        m_WayPoint = reader.ReadItem() as WayPoint;

                        goto case 1;
                    }

                case 1:
                    {
                        m_Group = reader.ReadBool();

                        goto case 0;
                    }

                case 0:
                    {
                        m_MinDelay = reader.ReadTimeSpan();
                        m_MaxDelay = reader.ReadTimeSpan();
                        m_Count = reader.ReadInt();
                        m_Team = reader.ReadInt();
                        m_HomeRange = reader.ReadInt();
                        m_Running = reader.ReadBool();

                        TimeSpan ts = TimeSpan.Zero;

                        if (m_Running)
                            ts = reader.ReadDeltaTime() - DateTime.Now;

                        int size = reader.ReadInt();

                        m_SpawnNames = new List<string>(size);

                        for (int i = 0; i < size; ++i)
                        {
                            string creatureString = reader.ReadString();

                            m_SpawnNames.Add(creatureString);
                            string typeName = ParseType(creatureString);

                            if (ScriptCompiler.FindTypeByName(typeName) == null)
                            {
                                if (m_WarnTimer == null)
                                    m_WarnTimer = new WarnTimer();

                                m_WarnTimer.Add(Location, Map, typeName);
                            }
                        }

                        int count = reader.ReadInt();

                        m_Spawned = new List<ISpawnable>(count);

                        for (int i = 0; i < count; ++i)
                        {
                            ISpawnable e = World.FindEntity(reader.ReadInt()) as ISpawnable;

                            if (e != null)
                            {
                                e.Spawner = this;
                                m_Spawned.Add(e);
                            }
                        }

                        if (m_Running)
                            DoTimer(ts);

                        break;
                    }
            }

            if (version < 3 && Weight == 0)
                Weight = -1;
        }
开发者ID:FreeReign,项目名称:imaginenation,代码行数:88,代码来源:Spawner.cs

示例9: Deserialize


//.........这里部分代码省略.........

                m_dMinTameSkill = reader.ReadDouble();

                if ( version < 9 )
                    reader.ReadDouble();

                m_bTamable = reader.ReadBool();
                m_bSummoned = reader.ReadBool();

                if ( m_bSummoned )
                {
                    m_SummonEnd = reader.ReadDeltaTime();
                    new UnsummonTimer( m_ControlMaster, this, m_SummonEnd - DateTime.Now ).Start();
                }

                m_iControlSlots = reader.ReadInt();
            }
            else
            {
                m_FightMode = FightMode.Closest;

                m_bControlled = false;
                m_ControlMaster = null;
                m_ControlTarget = null;
                m_ControlOrder = OrderType.None;
            }

            if ( version >= 3 )
                m_Loyalty = (PetLoyalty) reader.ReadInt();
            else
                m_Loyalty = PetLoyalty.WonderfullyHappy;

            if ( version >= 4 )
                m_CurrentWayPoint = reader.ReadItem() as WayPoint;

            if ( version >= 5 )
                m_SummonMaster = reader.ReadMobile();

            if ( version >= 6 )
            {
                m_HitsMax = reader.ReadInt();
                m_StamMax = reader.ReadInt();
                m_ManaMax = reader.ReadInt();
                m_DamageMin = reader.ReadInt();
                m_DamageMax = reader.ReadInt();
            }

            if ( version >= 7 )
            {
                m_PhysicalResistance = reader.ReadInt();
                m_PhysicalDamage = reader.ReadInt();

                m_FireResistance = reader.ReadInt();
                m_FireDamage = reader.ReadInt();

                m_ColdResistance = reader.ReadInt();
                m_ColdDamage = reader.ReadInt();

                m_PoisonResistance = reader.ReadInt();
                m_PoisonDamage = reader.ReadInt();

                m_EnergyResistance = reader.ReadInt();
                m_EnergyDamage = reader.ReadInt();
            }

            if ( version >= 8 )
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:67,代码来源:BaseCreature.cs

示例10: InitSpawn

		public void InitSpawn( int x, int y, int width, int height, string name, int maxCount, TimeSpan minDelay, TimeSpan maxDelay, TimeSpan duration,
			int proximityRange, int proximityTriggerSound, int amount, int team, int homeRange, bool isRelativeHomeRange, SpawnObject[] objectsToSpawn,
			TimeSpan minRefractory, TimeSpan maxRefractory, TimeSpan todstart, TimeSpan todend, Item objectPropertyItem, string objectPropertyName, string proximityMessage,
			string itemTriggerName, string noitemTriggerName, string speechTrigger, string mobTriggerName, string mobPropertyName, string playerPropertyName, double triggerProbability,
			Item setPropertyItem, bool isGroup, TODModeType todMode, int killReset, bool externalTriggering, int sequentialSpawning, string regionName, bool allowghost, bool allownpc, bool spawnontrigger,
			string configfile, TimeSpan despawnTime, string skillTrigger, bool smartSpawning, WayPoint wayPoint )
		{

			Visible = false;
			Movable = false;
			m_X = x;
			m_Y = y;
			m_Width = width;
			m_Height = height;

			// init spawn range if compatible
			if( width == height )
				m_SpawnRange = width / 2;
			else
				m_SpawnRange = -1;
			m_Running = true;
			m_Group = isGroup;

			if( (name != null) && (name.Length > 0) )
				Name = name;
			else
				Name = "Spawner";

			m_MinDelay = minDelay;
			m_MaxDelay = maxDelay;

			// duration and proximity range parameter
			m_MinRefractory = minRefractory;
			m_MaxRefractory = maxRefractory;
			m_TODStart = todstart;
			m_TODEnd = todend;
			m_TODMode = todMode;
			m_KillReset = killReset;
			m_Duration = duration;
			m_DespawnTime = despawnTime;
			m_ProximityRange = proximityRange;
			m_ProximityTriggerSound = proximityTriggerSound;
			m_proximityActivated = false;
			m_durActivated = false;
			m_refractActivated = false;
			m_Count = maxCount;
			m_Team = team;
			m_StackAmount = amount;
			m_HomeRange = homeRange;
			m_HomeRangeIsRelative = isRelativeHomeRange;
			m_ObjectPropertyItem = objectPropertyItem;
			m_ObjectPropertyName = objectPropertyName;
			m_ProximityTriggerMessage = proximityMessage;
			m_ItemTriggerName = itemTriggerName;
			m_NoItemTriggerName = noitemTriggerName;
			m_SpeechTrigger = speechTrigger;
			SkillTrigger = skillTrigger;        // note this will register the skill as well
			m_MobTriggerName = mobTriggerName;
			m_MobPropertyName = mobPropertyName;
			m_PlayerPropertyName = playerPropertyName;
			m_TriggerProbability = triggerProbability;
			m_SetPropertyItem = setPropertyItem;
			m_ExternalTriggering = externalTriggering;
			m_ExternalTrigger = false;
			m_SequentialSpawning = sequentialSpawning;
			RegionName = regionName;
			m_AllowGhostTriggering = allowghost;
			m_AllowNPCTriggering = allownpc;
			m_SpawnOnTrigger = spawnontrigger;
			m_SmartSpawning = smartSpawning;
			ConfigFile = configfile;
			m_WayPoint = wayPoint;

			// set the totalitem property to -1 so that it doesnt show up in the item count of containers
			//TotalItems = -1;
			//UpdateTotal(this, TotalType.Items, -1);

			// Create the array of spawned objects
			m_SpawnObjects = new ArrayList();

			// Assign the list of objects to spawn
			SpawnObjects = objectsToSpawn;

			// Kick off the process
			DoTimer( TimeSpan.FromSeconds( 1 ) );
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:86,代码来源:XmlSpawner2.cs

示例11: Deserialize


//.........这里部分代码省略.........

				m_dMinTameSkill = reader.ReadDouble();

				if ( version < 9 )
					reader.ReadDouble();

				m_bTamable = reader.ReadBool();
				m_bSummoned = reader.ReadBool();

				if ( m_bSummoned )
				{
					m_SummonEnd = reader.ReadDeltaTime();
					new UnsummonTimer( m_ControlMaster, this, m_SummonEnd - DateTime.Now ).Start();
				}

				m_iControlSlots = reader.ReadInt();
			}
			else
			{
				m_FightMode = FightMode.Closest;

				m_bControlled = false;
				m_ControlMaster = null;
				m_ControlTarget = null;
				m_ControlOrder = OrderType.None;
			}

			if ( version >= 3 )
				m_Loyalty = (PetLoyalty)reader.ReadInt();
			else
				m_Loyalty = PetLoyalty.WonderfullyHappy;

			if ( version >= 4 )
				m_CurrentWayPoint = reader.ReadItem() as WayPoint;

			if ( version >= 5 )
				m_SummonMaster = reader.ReadMobile();

			if ( version >= 6 )
			{
				m_HitsMax = reader.ReadInt();
				m_StamMax = reader.ReadInt();
				m_ManaMax = reader.ReadInt();
				m_DamageMin = reader.ReadInt();
				m_DamageMax = reader.ReadInt();
			}

			if ( version >= 7 )
			{
				m_PhysicalResistance = reader.ReadInt();
				m_PhysicalDamage = reader.ReadInt();

				m_FireResistance = reader.ReadInt();
				m_FireDamage = reader.ReadInt();

				m_ColdResistance = reader.ReadInt();
				m_ColdDamage = reader.ReadInt();

				m_PoisonResistance = reader.ReadInt();
				m_PoisonDamage = reader.ReadInt();

				m_EnergyResistance = reader.ReadInt();
				m_EnergyDamage = reader.ReadInt();
			}

			if (version >= 8)
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:67,代码来源:BaseCreature.cs

示例12: Deserialize


//.........这里部分代码省略.........
				case 3:
					{
						m_ShowContainerStatic = reader.ReadItem() as Static;
						goto case 2;
					}
				case 2:
					{
						m_Duration = reader.ReadTimeSpan();
						goto case 1;
					}
				case 1:
					{
						m_UniqueId = reader.ReadString();
						m_HomeRangeIsRelative = reader.ReadBool();
						goto case 0;
					}
				case 0:
					{
						m_Name = reader.ReadString();
						// backward compatibility with old name storage
						if( m_Name != null && m_Name != String.Empty ) Name = m_Name;
						m_X = reader.ReadInt();
						m_Y = reader.ReadInt();
						m_Width = reader.ReadInt();
						m_Height = reader.ReadInt();
						if( m_Width == m_Height )
							m_SpawnRange = m_Width / 2;
						else
							m_SpawnRange = -1;
						if( !haveproximityrange )
						{
							m_ProximityRange = -1;
						}
						m_WayPoint = reader.ReadItem() as WayPoint;
						m_Group = reader.ReadBool();
						m_MinDelay = reader.ReadTimeSpan();
						m_MaxDelay = reader.ReadTimeSpan();
						m_Count = reader.ReadInt();
						m_Team = reader.ReadInt();
						m_HomeRange = reader.ReadInt();
						m_Running = reader.ReadBool();

						if( m_Running == true )
						{
							TimeSpan delay = reader.ReadTimeSpan();
							DoTimer( delay );
						}

						// Read in the size of the spawn object list
						int SpawnListSize = reader.ReadInt();
						m_SpawnObjects = new ArrayList( SpawnListSize );
						for( int i = 0; i < SpawnListSize; ++i )
						{
							string TypeName = reader.ReadString();
							int TypeMaxCount = reader.ReadInt();

							SpawnObject TheSpawnObject = new SpawnObject( TypeName, TypeMaxCount );

							m_SpawnObjects.Add( TheSpawnObject );

							string typeName = BaseXmlSpawner.ParseObjectType( TypeName );
							// does it have a substitution that might change its validity?
							// if so then let it go

							if( typeName == null || ((SpawnerType.GetType( typeName ) == null) &&
								(!BaseXmlSpawner.IsTypeOrItemKeyword( typeName ) && typeName.IndexOf( '{' ) == -1 && !typeName.StartsWith( "*" ) && !typeName.StartsWith( "#" ))) )
开发者ID:greeduomacro,项目名称:hubroot,代码行数:67,代码来源:XmlSpawner2.cs

示例13: OnResponse

        public override void OnResponse( NetState state, RelayInfo info )
        {
            Mobile from = state.Mobile;
            switch ( info.ButtonID )
            {
            case 0:
            {

                                    from.CloseGump( typeof( StartStopCovetram ) );
                from.SendGump( new CityInvasion( from ) );
                                    break;
                             }
            case 1:
            {
            Point3D loc = new Point3D( 568, 1311, 0 );

            WayPoint point = new WayPoint();
            WayPoint point1 = new WayPoint();
            WayPoint point2 = new WayPoint();
            WayPoint point3 = new WayPoint();
            WayPoint point4 = new WayPoint();
            WayPoint point5 = new WayPoint();
            WayPoint point6 = new WayPoint();
            WayPoint point7 = new WayPoint();
            WayPoint point8 = new WayPoint();
            WayPoint point9 = new WayPoint();

            WayPoint point10 = new WayPoint();
            WayPoint point11 = new WayPoint();
            WayPoint point12 = new WayPoint();
            WayPoint point13 = new WayPoint();
            WayPoint point14 = new WayPoint();
            WayPoint point15 = new WayPoint();
            WayPoint point16 = new WayPoint();
            WayPoint point17 = new WayPoint();
            WayPoint point18 = new WayPoint();
            WayPoint point19 = new WayPoint();

            WayPoint point20 = new WayPoint();
            WayPoint point21 = new WayPoint();
            WayPoint point22 = new WayPoint();
            WayPoint point23 = new WayPoint();
            WayPoint point24 = new WayPoint();
            WayPoint point25 = new WayPoint();
            WayPoint point26 = new WayPoint();
            WayPoint point27 = new WayPoint();
            WayPoint point28 = new WayPoint();
            WayPoint point29 = new WayPoint();

            WayPoint point30 = new WayPoint();
            WayPoint point31 = new WayPoint();
            WayPoint point32 = new WayPoint();
            WayPoint point33 = new WayPoint();
            WayPoint point34 = new WayPoint();
            WayPoint point35 = new WayPoint();
            WayPoint point36 = new WayPoint();
            WayPoint point37 = new WayPoint();

            point.Name = "CoveInvasionTrammel";
            point1.Name = "CoveInvasionTrammel";
            point2.Name = "CoveInvasionTrammel";
            point3.Name = "CoveInvasionTrammel";
            point4.Name = "CoveInvasionTrammel";
            point5.Name = "CoveInvasionTrammel";
            point6.Name = "CoveInvasionTrammel";
            point7.Name = "CoveInvasionTrammel";
            point8.Name = "CoveInvasionTrammel";
            point9.Name = "CoveInvasionTrammel";

            point10.Name = "CoveInvasionTrammel";
            point11.Name = "CoveInvasionTrammel";
            point12.Name = "CoveInvasionTrammel";
            point13.Name = "CoveInvasionTrammel";
            point14.Name = "CoveInvasionTrammel";
            point15.Name = "CoveInvasionTrammel";
            point16.Name = "CoveInvasionTrammel";
            point17.Name = "CoveInvasionTrammel";
            point18.Name = "CoveInvasionTrammel";
            point19.Name = "CoveInvasionTrammel";

            point20.Name = "CoveInvasionTrammel";
            point21.Name = "CoveInvasionTrammel";
            point22.Name = "CoveInvasionTrammel";
            point23.Name = "CoveInvasionTrammel";
            point24.Name = "CoveInvasionTrammel";
            point25.Name = "CoveInvasionTrammel";
            point26.Name = "CoveInvasionTrammel";
            point27.Name = "CoveInvasionTrammel";
            point28.Name = "CoveInvasionTrammel";
            point29.Name = "CoveInvasionTrammel";

            point30.Name = "CoveInvasionTrammel";
            point31.Name = "CoveInvasionTrammel";
            point32.Name = "CoveInvasionTrammel";
            point33.Name = "CoveInvasionTrammel";
            point34.Name = "CoveInvasionTrammel";
            point35.Name = "CoveInvasionTrammel";
            point36.Name = "CoveInvasionTrammel";
            point37.Name = "CoveInvasionTrammel";

//.........这里部分代码省略.........
开发者ID:Ziden,项目名称:ServUO-EC-Test-Fork,代码行数:101,代码来源:StartstopCoveTrammel.cs

示例14: Deserialize

        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            m_Creatures = new Dictionary<IEntity, SpawnerEntry>();

            if ( version < 7 )
                m_Entries = new List<SpawnerEntry>();

            switch ( version )
            {
                case 7:
                {
                    int size = reader.ReadInt();

                    m_Entries = new List<SpawnerEntry>( size );

                    for ( int i = 0; i < size; ++i )
                        m_Entries.Add( new SpawnerEntry( this, reader ) );

                    goto case 4; //Skip the other crap
                }
                case 6:
                {
                    int size = reader.ReadInt();

                    bool addentries = m_Entries.Count == 0;

                    for ( int i = 0; i < size; ++i )
                        if ( addentries )
                            m_Entries.Add( new SpawnerEntry( String.Empty, 100, reader.ReadInt() ) );
                        else
                            m_Entries[i].CreaturesMaxCount = reader.ReadInt();

                    goto case 5;
                }
                case 5:
                {
                    int size = reader.ReadInt();

                    bool addentries = m_Entries.Count == 0;

                    for ( int i = 0; i < size; ++i )
                        if ( addentries )
                            m_Entries.Add( new SpawnerEntry( String.Empty, reader.ReadInt(), 1 ) );
                        else
                            m_Entries[i].CreaturesProbability = reader.ReadInt();

                    goto case 4;
                }
                case 4:
                {
                    m_WalkingRange = reader.ReadInt();

                    goto case 3;
                }
                case 3:
                case 2:
                {
                    m_WayPoint = reader.ReadItem() as WayPoint;

                    goto case 1;
                }

                case 1:
                {
                    m_Group = reader.ReadBool();

                    goto case 0;
                }

                case 0:
                {
                    m_MinDelay = reader.ReadTimeSpan();
                    m_MaxDelay = reader.ReadTimeSpan();
                    m_Count = reader.ReadInt();
                    m_Team = reader.ReadInt();
                    m_HomeRange = reader.ReadInt();
                    m_Running = reader.ReadBool();

                    TimeSpan ts = TimeSpan.Zero;

                    if ( m_Running )
                        ts = reader.ReadDeltaTime() - DateTime.Now;

                    if ( version < 7 )
                    {
                        int size = reader.ReadInt();

                        bool addentries = m_Entries.Count == 0;

                        for ( int i = 0; i < size; ++i )
                        {
                            string typeName = reader.ReadString();

                            if ( addentries )
                                m_Entries.Add( new SpawnerEntry( typeName, 100, 1 ) );
                            else
//.........这里部分代码省略.........
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:101,代码来源:Spawner.cs

示例15: Deserialize


//.........这里部分代码省略.........

				m_dMinTameSkill = reader.ReadDouble();

				if ( version < 9 )
					reader.ReadDouble();

				m_bTamable = reader.ReadBool();
				m_bSummoned = reader.ReadBool();

				if ( m_bSummoned )
				{
					m_SummonEnd = reader.ReadDeltaTime();
					new UnsummonTimer( m_ControlMaster, this, m_SummonEnd - DateTime.Now ).Start();
				}

				m_iControlSlots = reader.ReadInt();
			}
			else
			{
				m_FightMode = FightMode.Closest;

				m_bControlled = false;
				m_ControlMaster = null;
				m_ControlTarget = null;
				m_ControlOrder = OrderType.None;
			}

			if ( version >= 3 )
				m_Loyalty = reader.ReadInt();
			else
				m_Loyalty = MaxLoyalty; // Wonderfully Happy

			if ( version >= 4 )
				m_CurrentWayPoint = reader.ReadItem() as WayPoint;

			if ( version >= 5 )
				m_SummonMaster = reader.ReadMobile();

			if ( version >= 6 )
			{
				m_HitsMax = reader.ReadInt();
				m_StamMax = reader.ReadInt();
				m_ManaMax = reader.ReadInt();
				m_DamageMin = reader.ReadInt();
				m_DamageMax = reader.ReadInt();
			}

			if ( version >= 7 )
			{
				m_PhysicalResistance = reader.ReadInt();
				m_PhysicalDamage = reader.ReadInt();

				m_FireResistance = reader.ReadInt();
				m_FireDamage = reader.ReadInt();

				m_ColdResistance = reader.ReadInt();
				m_ColdDamage = reader.ReadInt();

				m_PoisonResistance = reader.ReadInt();
				m_PoisonDamage = reader.ReadInt();

				m_EnergyResistance = reader.ReadInt();
				m_EnergyDamage = reader.ReadInt();
			}

			if ( version >= 8 )
开发者ID:greeduomacro,项目名称:uotitan,代码行数:67,代码来源:BaseCreature.cs


注:本文中的Server.Items.WayPoint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。