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;
        }
    }
Ejemplo n.º 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();
 }