Example #1
0
        public virtual void Init(Position startingPosition, TurnManager turnManager, TileManager tileManager, BoardEntitySelector boardEntitySelector,
                                 BattleCalculator battleCalculator, Ka ka = null)
        {
            healthBarInstance = Instantiate(healthBar);
            healthBarInstance.transform.SetParent(FindObjectOfType <HealthBarContainer>().gameObject.transform);
            healthBarInstance.GetComponent <UIFollow>().target = gameObject;
            healthBarInstance.transform.SetAsFirstSibling();
            healthBarInstance.transform.position = new Vector3(100000, 100000);

            this.turnManager         = turnManager;
            this.tileManager         = tileManager;
            this.boardEntitySelector = boardEntitySelector;
            this.battleCalculator    = battleCalculator;

            isInit = true;
            tileManager.AddBoardEntity(startingPosition, gameObject);
            position = startingPosition;

            stats.updateStatHandler += UpdateUi;
            stats.Start(this);

            turnManager.AddBoardEntity((CharacterBoardEntity)this);
            UpdateUi();
        }