// Update is called once per frame void Update() { HpStatus hpStatus = transform.root.gameObject.GetComponent <HpStatus>(); float fPercentage = hpStatus.GetPerecentage(); transform.localScale = new Vector3(fPercentage * _initScale.x, _initScale.y, _initScale.z); }
public void reduceCharHp(int damage = 1) { reduceHp(damage); HpStatus.setHpStatus(this); if (getHp() != 0 && UIHandler.soundOn) { aud.clip = (AudioClip)Resources.Load("Audios/Sounds/KnightHit"); aud.Play(); } }
public void resetCharacter() { resetHp(132426233); HpStatus.setHpStatus(this); Animator animator = GetComponent <Animator>(); // 2 is index of "KnightFeet" GameObject Animator subAnimator = transform.GetChild(2).GetComponent <Animator>(); animator.Rebind(); subAnimator.Rebind(); }
// Start is called before the first frame update void Start() { status = hero.GetComponent <HpStatus>(); }
// Use this for initialization void Start() { _hpStatus = transform.root.gameObject.GetComponent <HpStatus>(); }