private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
示例#2
0
    void Awake()
    {
        if (singleton != null)
        {
            enabled = false;
            Destroy(this);
            return;
        }
        singleton = this;

        ouchSources = ouchSourcesObj.GetComponents <AudioSource>();
    }
示例#3
0
 void Start()
 {
     if (enemySpawner != null)
     {
         enemySpawner.numbOfEnemies++;
     }
     rb2d              = GetComponent <Rigidbody2D>();
     state             = stateMachine.roming;
     ogMoveSpeed       = moveSpeed;
     enemySoundManager = GetComponent <EnemySoundManager>();
     player            = GameObject.FindGameObjectWithTag("Player");
 }
示例#4
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");
 }
示例#5
0
文件: Shooter.cs 项目: KVN3/GE-2.3
 public void SetSoundManager(EnemySoundManager sm)
 {
     this.sm = sm;
 }
示例#6
0
 private void Awake()
 {
     instance = this;
     DontDestroyOnLoad(this);
 }
示例#7
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();
            }
        }
    }
示例#8
0
 private void Awake()
 {
     enemySoundManager = FindObjectOfType <EnemySoundManager>();
 }
示例#9
0
 public virtual void Awake()
 {
     enemySoundManager = Instantiate(enemySoundManagerClass, transform.localPosition, transform.localRotation, this.transform);
 }
示例#10
0
 private void Awake()
 {
     enemySoundManager = GetComponentInParent <EnemySoundManager>();
 }
 void Start()
 {
     source = GetComponent<AudioSource>();
     esm = GameObject.FindGameObjectWithTag("GameController").GetComponent<EnemySoundManager>();
 }