public virtual void TakeDamage(int ammount, DamageType.DamageTypes dtype = DamageType.DamageTypes.Default)
    {
        if (health.hull == 0)
        {
            //shipController.TakeDamage(ammount, DamageType.DamageTypes.Direct);//im wondering if we want these to be permenant holes in the shields or not.
            return;
        }

        int newhull = health.TakeDamage(ammount);

        if (newhull < 1)
        {
            shipController.TakeDamage(health.maxHull, DamageType.DamageTypes.Direct);

            foreach (GameObject gO in partsToHide)
            {
                gO.SetActive(false);
            }

            foreach (GameObject gO in destroyEffects)
            {
                gO.SetActive(true);
            }
        }
    }
Ejemplo n.º 2
0
    public int TakeDamage(int ammount, DamageType.DamageTypes dType = DamageType.DamageTypes.Default)//need to move this to fighter script
    {
        if (alive)
        {
            if (health.sheilds > 0)
            {
                ShowSheild();
            }

            int newHull = health.TakeDamage(ammount, dType);

            if (newHull > 0)
            {
                if (healthCo != null)
                {
                    StopCoroutine(healthCo);
                }

                healthCo = StartCoroutine(health.RefreshSheilds());
            }
            else
            {
                alive = false;
            }

            return(newHull);
        }

        return(0);
    }
Ejemplo n.º 3
0
    public void TakeDamage(int ammount, DamageType.DamageTypes dType = DamageType.DamageTypes.Default)
    {
        if (health.hull == 0)
        {
            return;
        }

        int healthCheck = health.TakeDamage(ammount, dType);

        if (healthCheck <= 0)
        {
            Explode();
        }
    }
Ejemplo n.º 4
0
    public virtual void TakeDamage(int ammount, DamageType.DamageTypes dType = DamageType.DamageTypes.Default)//need to move this to fighter script, on 2nd thought maybe not.
    {
        if (!myFighter.alive)
        {
            return;
        }

        int healthCheck = myFighter.TakeDamage(ammount, dType);

        if (healthCheck <= 0)
        {
            DestroyFighter();
        }
    }
Ejemplo n.º 5
0
    public int TakeDamage(int ammount, DamageType.DamageTypes dType = DamageType.DamageTypes.Default)
    {
        switch (dType)
        {
        case DamageType.DamageTypes.Default:    //Default
            TakeDamage_Default(ammount);
            break;

        case DamageType.DamageTypes.Direct:    //Direct
            TakeDamage_Direct(ammount);
            break;

        case DamageType.DamageTypes.ShieldsOnly:    //shields only
            TakeDamage_ShieldsOnly(ammount);
            break;

        default:
            TakeDamage_Default(ammount);
            break;
        }

        return(hull);
    }
Ejemplo n.º 6
0
 public virtual void TakeDamage(int ammount, DamageType.DamageTypes dType = DamageType.DamageTypes.Default)
 {
     health.TakeDamage(ammount, dType);
 }
Ejemplo n.º 7
0
 public override void TakeDamage(int ammount, DamageType.DamageTypes dType = DamageType.DamageTypes.Default)
 {
     base.TakeDamage(ammount, dType);
     canvasController.UpdateHealthBar(myFighter.health.hull, myFighter.health.sheilds);
 }