Exemplo n.º 1
0
    //this deals damage to friendlyMech
    void DoDMG(int Tar, int DMG_severity)
    {
        int DMG = 0;//idk why I called it this

        Debug.Log("sev is: " + DMG_severity);
        if (DMG_severity < 24)
        {
            DMG = MidDMG;
            MAS.DamageSound(1);
            SHAKE?.AddTrauma(.5f, .3f);
            //med damng
        }
        if (DMG_severity >= 24 && DMG_severity < 44)
        {
            DMG = MinDMG;
            MAS.DamageSound(0);
            SHAKE?.AddTrauma(.2f, .1f);
            //minDMG
        }
        if (DMG_severity >= 44)
        {
            MAS.DamageSound(2);
            DMG = MaxDMG;
            SHAKE?.AddTrauma(2f, .8f);
            //maxDMg
        }

        //if you still have shields
        if (compSliders[1].value > 0)
        {
            DMG -= ShieldMod;
            if (DMG < 0)
            {
                DMG = 0;
            }
        }

        //actually deal the damage
        compSliders[Tar].value -= DMG;
        Debug.Log("dmg was:" + DMG);
        CompStatusValue[Tar].text = compSliders[Tar].value.ToString();
        //make damage text appear
        DamageIndicator[Tar].text = "-" + DMG;
        checkSystemFailure(Tar);
        StartCoroutine(waitToMakeDamageNumberDisapear(3, Tar));

        if (compSliders[0].value <= 0)
        {
            //shake the f*****g camera
            Camera.main.GetComponent <ShakeCamera>().AddTrauma(5f, 1f);
            StartCoroutine(waitToEnd(4));
        }
    }
Exemplo n.º 2
0
    void DoShoot()
    {
        if (shoot == 1)
        {
            if (canFire && shotsLeft > 0)
            {
                reloading = false;
                shotsLeft--;
                canFire = false;

                GameObject bullet = Instantiate(bulletPrefab, muzzle.position, muzzle.rotation) as GameObject;
                bullet.GetComponent <Bullet>().Fire(bulletDirection);
                //play sound
                PAS.PlaySoundByIndex(1);
                //do shake
                SHAKE.AddTrauma(.08f, .15f);
                //muzzleFlash
                muzzleFlash.SetActive(true);
                StartCoroutine(waitToMakeFlashDisapear(.1f));
            }
        }
        else if (shoot <= fireRate)
        {
            canFire = true;
        }

        if (shotsLeft <= 0 && !reloading)
        {
            StartCoroutine(ReloadRoutine(reloadTime));
        }
    }
Exemplo n.º 3
0
 public void TakeDamage()
 {
     if (currentHealth > 0)
     {
         StartCoroutine(HitRoutine());
         currentHealth -= damageValue;
         UpdateUI();
         SHAKE.AddTrauma(.05f, .05f);
     }
     if (currentHealth <= 0)
     {
         GameOver();
     }
 }
Exemplo n.º 4
0
    public void RecieveDMG(float damage)
    {
        if (healthBar.value > 0)
        {
            healthBar.value    -= damage;
            part.text           = healthBar.value.ToString();
            damageRecieved.text = "-" + damage;
            StartCoroutine(waitToMakeDMGTextDisapear(4));
        }

        if (healthBar.value <= 0)
        {
            //shake the f*****g camera
            shake.AddTrauma(5f, 1f);
            ComponentStatusScr.COMPONENT_STATUS.winSound();
            //make win courroutine
            StartCoroutine(waitToEnd(5));
        }
    }