FrontendStatBase uilife; //monovehaviour que hay que pasarle por constructor public void Config(int life_count_Max, Action OnLoseLife, Action OnGainLife, Action OnDeath, FrontendStatBase _uilife, int initial_life = -1) { uilife = _uilife; life = new LifeBase(life_count_Max, uilife, initial_life); life.AddEventListener_Death(OnDeath); life.AddEventListener_GainLife(OnGainLife); life.AddEventListener_LoseLife(OnLoseLife); }
protected void CreateLifeBar() { var tempBar = Instantiate(lifeBar, canvas.transform); tempBar.SetCanvasPopUp(transform, canvas); uilife = tempBar.GetComponent <LifeBar>(); lifeSystemEnemy = new LifeSystemBase(); lifeSystemEnemy.Config(life, EVENT_OnLoseLife, EVENT_OnGainLife, EVENT_OnDeath, uilife, life); }
public LifeBase(int maxHealth, FrontendStatBase _uilife, int initial_Life = -1) : base(maxHealth, initial_Life) { uilife = _uilife; uilife.OnValueChange(maxHealth, maxHealth); }
public CharLifeSystem(int max, int current, FrontendStatBase ui) { lifesystem = new LifeSystemBase(); lifesystem.Config(max, EVENT_OnLoseLife, EVENT_OnGainLife, EVENT_OnDeath, ui, current); lifesystem.AddCallback_LifeChange(OnLifeChange); }