Example #1
0
    private void UseUlt()
    {
        // play ult anim
        if (FireUltAnim != null)
        {
            FireUltAnim(this, EventArgs.Empty);
        }

        // shoot raycasts to left and right to apply damage
        RaycastHit2D rightUlt = Physics2D.Raycast(transform.position, Vector2.right, 20f, layerMask);
        RaycastHit2D leftUlt  = Physics2D.Raycast(transform.position, Vector2.left, 20f, layerMask);

        // damage enemy hit
        if (leftUlt.collider)
        {
            leftUlt.collider.gameObject.GetComponent <EnemyManager>().hBar.healthSystem.Damage(ultDamage);
        }
        if (rightUlt.collider)
        {
            rightUlt.collider.gameObject.GetComponent <EnemyManager>().hBar.healthSystem.Damage(ultDamage);
        }

        // empty ult bar
        ultBar.SetUlt(0);
    }
Example #2
0
    private void Start()
    {
        // health
        pHealth = new HealthSystem(100, 1f);
        var healthBarTransform = Instantiate(pfHealthBar,
                                             new Vector3(transform.position.x, transform.position.y + positionOffset),
                                             Quaternion.identity,
                                             transform);
        var healthBar = healthBarTransform.GetComponent <HealthBar>();

        healthBar.Setup(pHealth);

        // ult amt start of scene
        ultBar.SetUlt(0);
    }