void Update()
    {
        barDisplay = controller.health / controller.maxHealth;

        sprite.clipTopRight = new Vector2(barDisplay, 1);
        sprite.color        = TurretStateManager.GetStateColor(controller.State);
    }
Пример #2
0
    public void Heal(float amount)
    {
        this.Health = this.Health + amount;

        state = TurretStateManager.GetState(health);

        if (objSprite == null)
        {
            return;
        }

        objSprite.color = TurretStateManager.GetStateColor(state);
    }
Пример #3
0
    public void TakeDamage(float amount)
    {
        //Debug.Log("TurretBarrelController:TakeDamage() - amount = " + amount);

        health -= amount;

        health = Mathf.Clamp(health, 0.0f, maxHealth);

        state = TurretStateManager.GetState(health);

        if (objSprite == null)
        {
            return;
        }

        objSprite.color = TurretStateManager.GetStateColor(state);

        GameInfoManager.Instance.IncrementDamageReceived(amount);
    }