/// <summary> /// Initialize the GO /// </summary> /// <param name="entry"></param> /// <param name="templ"></param> internal virtual void Init(GOEntry entry, GOTemplate 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); }
/// <summary> /// Creates a new GameObject with the given parameters /// </summary> public static GameObject Create(GOEntry entry, GOTemplate 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; }
/// <summary> /// Creates a new GameObject with the given parameters /// </summary> public static GameObject Create(GOEntryId id, GOTemplate templ) { var entry = GOMgr.GetEntry(id); if (entry != null) { return Create(entry, templ); } return null; }
/// <summary> /// /// </summary> /// <param name="map"></param> /// <param name="pos"></param> /// <param name="autoSpawn">Whether to always spawn this Template when the Region starts</param> public GOTemplate AddTemplate(MapId region, Vector3 pos, bool autoSpawn) { var go = new GOTemplate { MapId = region, Pos = pos, AutoSpawn = autoSpawn }; Templates.Add(go); return go; }
public void AddTemplate(GOTemplate template) { Templates.Add(template); }
public void RegisterFlagstand(GOTemplate template) { template.Entry.Used += (go, chr) => { if (go == FlagStand) { if (Challenged) { InterruptCapture(chr); return true; } BeginCapture(chr); return true; } return false; }; }