コード例 #1
0
    // Start is called before the first frame update
    void Start()
    {
        this.currentHealth = this.maxHealth;
        var healthBarObject = Instantiate(this.healthBarPrefab, References.canvas.transform);

        this.healthBarBehaviour = healthBarObject.GetComponent <HealthBarBehaviour>();
    }
コード例 #2
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject healthBarObject = Instantiate(healthbarPrefab, References.theCanvas.transform);

        myHealthBar   = healthBarObject.GetComponent <HealthBarBehaviour>();
        currentHealth = maxHealth;
    }
コード例 #3
0
    // Start is called before the first frame update
    void Start() //create health panel on canvas
    {
        currentHealth = maxHealth;

        GameObject healthBarObject = Instantiate(healthBarPrefab, References.canvas.transform);

        myHealthBar = healthBarObject.GetComponent <HealthBarBehaviour>();
    }
コード例 #4
0
    public void ReplaceHealthBarBehaviour(HealthBarBehaviour newValue)
    {
        var index     = GameComponentsLookup.HealthBarBehaviour;
        var component = CreateComponent <HealthBarBehaviourComponent>(index);

        component.value = newValue;
        ReplaceComponent(index, component);
    }
コード例 #5
0
 // Start is called before the first frame update
 void Start()
 {
     healthBar = Instantiate(healthBarPrefab, gameObject.transform);
     healthBar.transform.parent = gameObject.transform;
     myHealthBar = healthBar.GetComponent <HealthBarBehaviour>();
     currHealth  = maxHealth;
     mainCamera  = Camera.main;
     isDead      = false;
 }
コード例 #6
0
ファイル: HealthSystem.cs プロジェクト: Gr8th1ngy/Maat
    // Start is called before the first frame update
    void Start()
    {
        GameObject healthBarObject = Instantiate(healthbarPrefab, References.canvas.transform);

        myHealthBar   = healthBarObject.GetComponent <HealthBarBehaviour>();
        currentHealth = maxHealth;

        isDead           = false;
        timeUntilDestroy = timeBeforeDestroy;
    }
コード例 #7
0
    void Start()
    {
        if (heathBar == null)
        {
            heathBar = FindObjectOfType <HealthBarBehaviour>();
        }

        if (player == null)
        {
            player = FindObjectOfType <PlayerLifeTime>();
        }
    }
コード例 #8
0
 // Start is called before the first frame update
 public void Start()
 {
     frontCannon                      = transform.Find("Cannons").Find("FrontCannon");
     leftCannons[0]                   = transform.Find("Cannons").Find("LeftFrontCannon");
     leftCannons[1]                   = transform.Find("Cannons").Find("LeftCenterCannon");
     leftCannons[2]                   = transform.Find("Cannons").Find("LeftBackCannon");
     rightCannons[0]                  = transform.Find("Cannons").Find("RightFrontCannon");
     rightCannons[1]                  = transform.Find("Cannons").Find("RightCenterCannon");
     rightCannons[2]                  = transform.Find("Cannons").Find("RightBackCannon");
     health                           = maxHealth;
     healthBarInstance                = Instantiate(healthBar);
     healthBarInstance.owner          = transform;
     healthBarInstance.hpSlider.value = 1;
 }
コード例 #9
0
    // Start is called before the first frame update
    void Start()
    {
        healthBar = Instantiate(HealthBarPrefab).GetComponent <HealthBarBehaviour>();
        Vector3 healthbarPosition = transform.position;

        healthbarPosition.y          = 10.5f;
        healthBar.transform.position = healthbarPosition;
        healthPoints = MaxHealth * 0.5f;
        healthBar.AngleToCamera();
        UpdateHealthBar();
        Barricade.material.mainTextureScale = new Vector2(1, 1);

        SecToNextAttack = SecBetweenAttacks;

        animator = GetComponent <Animator>();
    }
コード例 #10
0
 public void SetHealthBar(HealthBarBehaviour newHealthBar)
 {
     healthBar = newHealthBar;
 }