Example #1
0
		public void RegisterFlagstand(GOSpawn spawn)
		{
			spawn.Entry.Used += (go, chr) =>
			{
				if (go == FlagStand)
				{
					if (Challenged)
					{
						InterruptCapture(chr);
						return true;
					}

					BeginCapture(chr);
					return true;
				}
				return false;
			};
		}
Example #2
0
File: GOMgr.cs Project: NVN/WCell
		public static void AddTemplate(GOSpawn spawn)
		{
			var list = TemplatesByMap[(int)spawn.MapId];
			if (list == null)
			{
				TemplatesByMap[(int)spawn.MapId] = list = new List<GOSpawn>(100);
			}
			list.Add(spawn);
		}
Example #3
0
		/// <summary>
		/// Creates a new GameObject with the given parameters
		/// </summary>
		public static GameObject Create(GOEntry entry, GOSpawn templ)
		{
			var go = entry.GOCreator();
			var handlerCreator = entry.HandlerCreator;
			go.Init(entry, templ); 
			if (handlerCreator != null)
			{
				go.Handler = handlerCreator();
			}
			else
			{
				log.Warn("GOEntry {0} did not have a HandlerCreator set - Type: {1}", entry, entry.Type);
				go.Delete();
				return null;
			}
			return go;
		}
Example #4
0
		/// <summary>
		/// Initialize the GO
		/// </summary>
		/// <param name="entry"></param>
		/// <param name="templ"></param>
		internal virtual void Init(GOEntry entry, GOSpawn templ)
		{
			EntityId = EntityId.GetGameObjectId((uint)Interlocked.Increment(ref _lastGOUID), entry.GOId);
			Type |= ObjectTypes.GameObject;
			//DynamicFlagsLow = GameObjectDynamicFlagsLow.Activated;
			m_entry = entry;
			m_template = templ;

			DisplayId = entry.DisplayId;
			EntryId = entry.Id;
			GOType = entry.Type;
			Flags = m_entry.Flags;
			m_faction = m_entry.Faction ?? Faction.NullFaction;
			ScaleX = m_entry.DefaultScale;

			if (templ != null)
			{
				Phase = templ.PhaseMask;
				State = templ.State;
				if (templ.Scale != 1)
				{
					ScaleX = templ.Scale;
				}
				Orientation = templ.Orientation;
				AnimationProgress = templ.AnimProgress;
				SetRotationFields(templ.Rotations);
			}

			m_entry.InitGO(this);
		}
Example #5
0
		/// <summary>
		/// Creates a new GameObject with the given parameters
		/// </summary>
		public static GameObject Create(GOEntryId id, GOSpawn templ)
		{
			var entry = GOMgr.GetEntry(id);
			if (entry != null)
			{
				return Create(entry, templ);
			}
			return null;
		}