private void Start()
    {
        //setup bar controller
        if (hpBar != null)
        {
            hpBar.SetMaxValue(maxValue);
            hpBar.SetMinValue(minValue);
        }

        if (startAtMaximum)
        {
            startValue = maxValue;
        }
        //set start value into current value
        if (startValue < minValue)
        {
            currentValue = minValue;
        }
        else if (startValue > maxValue)
        {
            currentValue = maxValue;
        }
        else
        {
            currentValue = startValue;
        }
    }
Beispiel #2
0
 public void Initialize(Character character, Tile tile)
 {
     this.Character       = character;
     tile.BoardPiece      = this.gameObject;
     this.gameObject.name = this.ToString();
     this.MoveSpeed       = character.MoveSpeed;
     this.Tile            = tile;
     this.Team            = Character.Team;
     this.Attack          = Character.Attack;
     this.Defense         = Character.Defense;
     this.Speed           = Character.MoveSpeed;
     this.MaxHealth       = Character.MaxHealth;
     this.Health          = Character.MaxHealth;
     HasDied          = false;
     _hasActed        = true;
     HasMoved         = true;
     TurnStartEffects = new List <Effect>();
     TurnEndEffects   = new List <Effect>();
     healthBar        = gameObject.GetComponentInChildren <BarController>();
     healthBar.SetMaxValue(character.MaxHealth);
     healthBar.SetMinValue(0);
     healthBar.SetValue(character.MaxHealth);
     actionMenu            = gameObject.GetComponentInChildren <PanelScript>();
     actionMenu.unit       = this;
     actionMenu.grid       = Tile.gameBoard;
     this.InjuryMultiplier = character.InjuryMultiplier;
     this.HitMultiplier    = character.HitMultiplier;
     if (Team == 0)
     {
         Image health = gameObject.transform.Find("HealthBarCanvas/healthBar/healthFill").gameObject.GetComponent <Image>();
         health.color = Color.blue;
     }
     actionMenu.HidePanel();
 }
Beispiel #3
0
    void Start()
    {
        AlimentationBar = GameObject.Find("AlimentationBar").GetComponent <BarController>();
        HappinessBar    = GameObject.Find("HappinessBar").GetComponent <BarController>();
        LoveBar         = GameObject.Find("LoveBar").GetComponent <BarController>();

        AlimentationBar.SetMaxValue(alimentation);
        HappinessBar.SetMaxValue(happiness);
        LoveBar.SetMaxValue(love);
    }
 void Start()
 {
     currentHealth = maxHealth;
     healthBar.SetMaxValue(maxHealth);
     panel.HidePanel();
 }