Esempio n. 1
0
    [HideInInspector] bool enemyHasCollided          = false;                  // Tracks whenever the Enemy makes a collision with the Player.

    void Start()
    {
        // Immedaitely passes the numeric value within enemyMaxHealth to enemyCurrentHealth.
        healthCalculator.Init();

        // Checks to see if a statusIndicator is made available in the inpsector.
        if (statusIndicator == null)
        {
            // Provides an alert to the Unity Editor's Console Log.
            Debug.LogError("No status indicator referenced on Enemy");
        }

        else
        {
            // Otherwise pass the values obtained in healthCalculator to the StatusIndicator.
            statusIndicator.SetHealth(healthCalculator.enemyCurrentHealth, healthCalculator.enemyMaxHealth);
        }
    }
Esempio n. 2
0
    [SerializeField] float invincibilityTimer    = 2.0f;                  // Sets a limit on when the Player should be able to take damage again.

    void Start()
    {
        // Immedaitely passes the numeric value within playerMaxHealth to playerCurrentHealth.
        healthCalculator.Init();
        // Locate and obtain access to the GameMaster prefab.
        gameMaster = FindObjectOfType <GameMaster>();

        // Checks to see if a statusIndicator is made available in the inpsector.
        if (statusIndicator == null)
        {
            // Provides an alert to the Unity Editor's Console Log.
            Debug.LogError("No status indicator referenced on Player");
        }

        else
        {
            // Otherwise pass the values obtained in healthCalculator to the StatusIndicator.
            statusIndicator.SetHealth(healthCalculator.playerCurrentHealth, healthCalculator.playerMaxHealth);
        }
    }