Example #1
0
    // 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);
    }
Example #2
0
    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();
        }
    }
Example #3
0
    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();
    }
Example #4
0
 // Start is called before the first frame update
 void Start()
 {
     status = hero.GetComponent <HpStatus>();
 }
Example #5
0
 // Use this for initialization
 void Start()
 {
     _hpStatus = transform.root.gameObject.GetComponent <HpStatus>();
 }