Beispiel #1
0
 public void BeenHit(bool wasWindballOrDrop, int charaID)
 {
     if (anim != null && hasParam)
     {
         anim.ResetTrigger("Hurt");
         anim.SetTrigger("Hurt");
     }
     StopCoroutine("SendFlyingCoro");
     currentChara = PlayerManager.GetPlayer(charaID);
     SendFlying(wasWindballOrDrop);
     if (!infiniteHealth)
     {
         if (useBigOuchSounds)
         {
             EnemySoundManager.PlayBigOuchSound();
         }
         else
         {
             EnemySoundManager.PlayOuchSound();
         }
     }
     StopCoroutine("HitFlash");
     StartCoroutine("HitFlash");
 }
Beispiel #2
0
    //
    public void Death()
    {
        if (enemyBarrier)
        {
            enemyBarrier.EnemyKilled();
        }

        if (anim != null && hasParam)
        {
            anim.ResetTrigger("Hurt");
            anim.SetTrigger("Hurt");
        }
        if (useBigOuchSounds)
        {
            EnemySoundManager.PlayBigOuchSound();
        }
        else
        {
            EnemySoundManager.PlayOuchSound();
        }
        StopCoroutine("HitFlash");
        StartCoroutine("HitFlash");

        if (icodescript != null)
        {
            icodescript.enabled = false;
        }
        this.GetComponent <Collider>().enabled = false;
        if (anim)
        {
            anim.SetBool("Die", true);
        }

        if (icodescript == null)
        {
            GameObject.FindWithTag("FXPool").GetComponent <BerryPFX>().PlayEffect(3, this.transform.position, this.gameObject, Vector3.zero, false);
        }
        else
        {
            GameObject.FindWithTag("FXPool").GetComponent <BerryPFX>().PlayEffect(3, this.transform.position, icodescript.gameObject, Vector3.zero, true);
        }

        if (rb)
        {
            rb.isKinematic = false;
            rb.useGravity  = true;
        }

        if (sound != null && dieSound != null)
        {
            sound.clip = dieSound;
            sound.Play();
        }
        StartCoroutine(Killed());

        // counter for trophies
        if (isDark)
        {
            //
            int darkKilledEnemies;
            if (!PlayerPrefs.HasKey("DarkEnemiesKilledCount"))
            {
                PlayerPrefs.SetInt("DarkEnemiesKilledCount", 0);
                darkKilledEnemies = 0;
            }
            else
            {
                darkKilledEnemies = PlayerPrefs.GetInt("DarkEnemiesKilledCount");
            }
            //
            if (darkKilledEnemies < 100)
            {
                darkKilledEnemies++;
                PlayerPrefs.SetInt("DarkEnemiesKilledCount", darkKilledEnemies);

                //
                if (PlayerPrefs.HasKey("DarkEnemiesAchiev"))
                {
                    if (PlayerPrefs.GetInt("DarkEnemiesAchiev") == 0 && darkKilledEnemies >= 100)
                    {
                        SetDarkAchievs();
                    }
                }
                else
                {
                    PlayerPrefs.SetInt("DarkEnemiesAchiev", 0);
                }
            }
            else
            {
                SetDarkAchievs();
            }
        }
        else
        {
            //
            int normalKilledEnemies;
            if (!PlayerPrefs.HasKey("NormalEnemiesKilledCount"))
            {
                PlayerPrefs.SetInt("NormalEnemiesKilledCount", 0);
                normalKilledEnemies = 0;
            }
            else
            {
                normalKilledEnemies = PlayerPrefs.GetInt("NormalEnemiesKilledCount");
            }
            //
            if (normalKilledEnemies < 100)
            {
                normalKilledEnemies++;
                PlayerPrefs.SetInt("NormalEnemiesKilledCount", normalKilledEnemies);

                //
                if (PlayerPrefs.HasKey("NormalEnemiesAchiev"))
                {
                    if (PlayerPrefs.GetInt("NormalEnemiesAchiev") == 0 && normalKilledEnemies >= 100)
                    {
                        SetNormalAchievs();
                    }
                }
                else
                {
                    PlayerPrefs.SetInt("NormalEnemiesAchiev", 0);
                }
            }
            else
            {
                SetNormalAchievs();
            }
        }
    }