Exemplo n.º 1
0
            public void Initialize(Actor actor)
            {
                Actor     = actor;
                HealthBar = transform.Find("HealthBar").GetComponent <HealthBar>();
                if (HealthBar == null)
                {
                    throw new UnityException("Please verify the structure of the ActorPortrait: HealthBar is missing.");
                }
                HealthBar.Initialize(actor);

                FoodBar = transform.Find("FoodBar").GetComponent <FoodBar>();
                if (FoodBar == null)
                {
                    throw new UnityException("Please verify the structure of the ActorPortrait: FoodBar is missing.");
                }
                FoodBar.Initialize(actor);

                StatusHandler = transform.Find("StatusesHandler").GetComponent <StatusHandler>();
                if (StatusHandler == null)
                {
                    throw new UnityException("Please verify the structure of the ActorPortrait: StatusesHandler is missing.");
                }
                StatusHandler.Initialize(actor.Guid);

                Selection = transform.Find("Selection").gameObject;
                if (Selection == null)
                {
                    throw new UnityException("Please verify the structure of the ActorPortrait: Selection is missing.");
                }
                Selection.SetActive(false);
                actor.OnSelectionEvent += EnableSelection;
            }
Exemplo n.º 2
0
 public void OnDelete(Actor actor)
 {
     HealthBar.OnDelete(actor);
     FoodBar.OnDelete(actor);
     actor.OnSelectionEvent -= EnableSelection;
 }
Exemplo n.º 3
0
 private void Awake()
 {
     foodBar = this;
 }