Playground by Górka Mateusz
Goo.Visuals.FloatingTexts.FloatingTextManager< TLabel > Class Template Reference
+ Inheritance diagram for Goo.Visuals.FloatingTexts.FloatingTextManager< TLabel >:
+ Collaboration diagram for Goo.Visuals.FloatingTexts.FloatingTextManager< TLabel >:

Classes

struct  TextPoolerType
 

Public Member Functions

void OnEvent (IFloatingTextEvent< TLabel > e)
 
- Public Member Functions inherited from Goo.Tools.EventSystem.IEventListener< IFloatingTextEvent< TLabel > >
void OnEvent (T e)
 

Protected Member Functions

virtual void Awake ()
 
virtual void OnEnable ()
 
virtual void OnDisable ()
 

Private Member Functions

void UpdateLinkDictionary ()
 

Private Attributes

TextPoolerType[] _poolerTypes
 
Transform _camera
 
readonly Dictionary< TLabel, int > _links = new Dictionary<TLabel, int>()
 

Member Function Documentation

◆ Awake()

virtual void Goo.Visuals.FloatingTexts.FloatingTextManager< TLabel >.Awake ( )
inlineprotectedvirtual
25 {
26 if (_camera == null) _camera = Camera.main.transform;
28 }
void UpdateLinkDictionary()
Definition: FloatingTextManager.cs:40
Transform _camera
Definition: FloatingTextManager.cs:20

◆ OnEnable()

virtual void Goo.Visuals.FloatingTexts.FloatingTextManager< TLabel >.OnEnable ( )
inlineprotectedvirtual
31 {
32 this.SubscribeEvent();
33 }

◆ OnDisable()

virtual void Goo.Visuals.FloatingTexts.FloatingTextManager< TLabel >.OnDisable ( )
inlineprotectedvirtual
36 {
37 this.UnsubscribeEvent();
38 }

◆ UpdateLinkDictionary()

void Goo.Visuals.FloatingTexts.FloatingTextManager< TLabel >.UpdateLinkDictionary ( )
inlineprivate
41 {
42 _links.Clear();
43 for (int i = 0; i < _poolerTypes.Length; i++)
44 {
46 }
47 }
TextPoolerType[] _poolerTypes
Definition: FloatingTextManager.cs:19
readonly Dictionary< TLabel, int > _links
Definition: FloatingTextManager.cs:22
TLabel Label
Definition: FloatingTextManager.cs:15

◆ OnEvent()

void Goo.Visuals.FloatingTexts.FloatingTextManager< TLabel >.OnEvent ( IFloatingTextEvent< TLabel >  e)
inline
50 {
51 if (_links.TryGetValue(e.Label, out int index))
52 {
53 var pooler = _poolerTypes[index].Prefab;
54 var floatingText = AutoObjectPooler.GetObject<IFloatingText>(pooler);
55 floatingText.SetText(e.Message, e.Position, _camera.rotation);
56 return;
57 }
58
59 this.LogError($"FloatingTextManager doesn't contain {e.Label} pooler");
60 }
Definition: AutoObjectPooler.cs:9
static GameObject GetObject(GameObject prefab, bool dontCreatePoolerParent=false)
Definition: AutoObjectPooler.cs:33
GameObject Prefab
Definition: FloatingTextManager.cs:16

Member Data Documentation

◆ _poolerTypes

◆ _camera

Transform Goo.Visuals.FloatingTexts.FloatingTextManager< TLabel >._camera
private

◆ _links

readonly Dictionary<TLabel, int> Goo.Visuals.FloatingTexts.FloatingTextManager< TLabel >._links = new Dictionary<TLabel, int>()
private

The documentation for this class was generated from the following file: