Example #1
0
    private void Awake()
    {
        healthbar = (GetComponentInChildren <Slider>()) ? GetComponentInChildren <Slider>() : null;

        if (character.healthRepresentation == HealthRepresentation.healthbar && healthbar != null)
        {
            healthbar.maxValue = character.health;
            healthbar.value    = character.currentHealth;
        }
        else if (healthbar != null)
        {
            healthbar.gameObject.SetActive(false);
        }

        charInfo = FindObjectOfType <CharInfo>();

        boxCollider      = GetComponent <BoxCollider>();
        boxCollider.size = collidersize;

        if (!haveBody)
        {
            var charObj = Instantiate(character.Model, this.gameObject.transform);
            charObj.transform.SetParent(this.gameObject.transform);
        }

        charInfo.DisableMenu(false);
    }