Пример #1
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.tag == "Enemy")
        {
            Enemy e = col.gameObject.GetComponent <Enemy>();
            if (e != null)
            {
                if (!(e.GameplayState == 3))
                {
                    e.GameplayState = 3;
                    e.AnimState     = 3;
                    e.curFrame      = 0;
                    level.GetComponent <levelManager>().enemycount--;
                    AudioSource.PlayClipAtPoint(ed, new Vector3(0, 0, 0), vol);
                }
                else
                {
                    e.GameplayState = 0;
                    e.AnimState     = 0;
                    e.curFrame      = 0;
                    e.patterncount  = 0;
                    level.GetComponent <levelManager>().enemycount++;
                    e.GetComponent <SpriteRenderer>().enabled = true;
                    e.GetComponent <SpriteRenderer>().sprite  = e.IdleAnimations[0];
                    AudioSource.PlayClipAtPoint(eu, new Vector3(0, 0, 0), vol);
                }
                Destroy(gameObject);
                return;
            }

            Enemy1 e1 = col.gameObject.GetComponent <Enemy1>();
            if (e1 != null)
            {
                if (!(e1.GameplayState == 3))
                {
                    e1.GameplayState = 3;
                    e1.AnimState     = 3;
                    e1.curFrame      = 0;
                    level.GetComponent <levelManager>().enemycount--;
                    AudioSource.PlayClipAtPoint(ed, new Vector3(0, 0, 0), vol);
                }
                else
                {
                    e1.GameplayState = 0;
                    e1.AnimState     = 0;
                    e1.curFrame      = 0;
                    e1.patterncount  = 0;
                    level.GetComponent <levelManager>().enemycount++;
                    e1.GetComponent <SpriteRenderer>().enabled = true;
                    e1.GetComponent <SpriteRenderer>().sprite  = e1.IdleAnimations[0];
                    AudioSource.PlayClipAtPoint(eu, new Vector3(0, 0, 0), vol);
                }
                Destroy(gameObject);
                return;
            }
            Enemy2 e2 = col.gameObject.GetComponent <Enemy2>();
            if (e2 != null)
            {
                if (!(e2.GameplayState == 3))
                {
                    e2.GameplayState = 3;
                    e2.AnimState     = 3;
                    e2.curFrame      = 0;
                    level.GetComponent <levelManager>().enemycount--;
                    AudioSource.PlayClipAtPoint(ed, new Vector3(0, 0, 0), vol);
                }
                else
                {
                    e2.GameplayState = 0;
                    e2.AnimState     = 0;
                    e2.curFrame      = 0;
                    e2.patterncount  = 0;
                    level.GetComponent <levelManager>().enemycount++;
                    e2.GetComponent <SpriteRenderer>().enabled = true;
                    e2.GetComponent <SpriteRenderer>().sprite  = e2.IdleAnimations[0];
                    AudioSource.PlayClipAtPoint(eu, new Vector3(0, 0, 0), vol);
                }
                Destroy(gameObject);
                return;
            }
            Enemy3 e3 = col.gameObject.GetComponent <Enemy3>();
            if (e3 != null)
            {
                if (!(e3.GameplayState == 3))
                {
                    e3.GameplayState = 3;
                    e3.AnimState     = 3;
                    e3.curFrame      = 0;
                    level.GetComponent <levelManager>().enemycount--;
                    AudioSource.PlayClipAtPoint(ed, new Vector3(0, 0, 0), vol);
                }
                else
                {
                    e3.GameplayState = 0;
                    e3.AnimState     = 0;
                    e3.curFrame      = 0;
                    e3.patterncount  = 0;
                    level.GetComponent <levelManager>().enemycount++;
                    e3.GetComponent <SpriteRenderer>().enabled = true;
                    e3.GetComponent <SpriteRenderer>().sprite  = e3.IdleAnimations[0];
                    AudioSource.PlayClipAtPoint(eu, new Vector3(0, 0, 0), vol);
                }
                Destroy(gameObject);
                return;
            }
            Enemy4 e4 = col.gameObject.GetComponent <Enemy4>();
            if (e4 != null)
            {
                if (!(e4.GameplayState == 3))
                {
                    e4.GameplayState = 3;
                    e4.AnimState     = 3;
                    e4.curFrame      = 0;
                    level.GetComponent <levelManager>().enemycount--;
                    AudioSource.PlayClipAtPoint(ed, new Vector3(0, 0, 0), vol);
                }
                else
                {
                    e4.GameplayState = 0;
                    e4.AnimState     = 0;
                    e4.curFrame      = 0;
                    e4.patterncount  = 0;
                    level.GetComponent <levelManager>().enemycount++;
                    e4.GetComponent <SpriteRenderer>().enabled = true;
                    e4.GetComponent <SpriteRenderer>().sprite  = e4.IdleAnimations[0];
                    AudioSource.PlayClipAtPoint(eu, new Vector3(0, 0, 0), vol);
                }
                Destroy(gameObject);
                return;
            }
            Enemy5 e5 = col.gameObject.GetComponent <Enemy5>();
            if (e5 != null)
            {
                if (!(e5.GameplayState == 3))
                {
                    e5.GameplayState = 3;
                    e5.AnimState     = 3;
                    e5.curFrame      = 0;
                    level.GetComponent <levelManager>().enemycount--;
                    AudioSource.PlayClipAtPoint(ed, new Vector3(0, 0, 0), vol);
                }
                else
                {
                    e5.GameplayState = 0;
                    e5.AnimState     = 0;
                    e5.curFrame      = 0;
                    e5.patterncount  = 0;
                    level.GetComponent <levelManager>().enemycount++;
                    e5.GetComponent <SpriteRenderer>().enabled = true;
                    e5.GetComponent <SpriteRenderer>().sprite  = e5.IdleAnimations[0];
                    AudioSource.PlayClipAtPoint(eu, new Vector3(0, 0, 0), vol);
                }
                Destroy(gameObject);
                return;
            }
            Enemy6 e6 = col.gameObject.GetComponent <Enemy6>();
            if (e6 != null)
            {
                if (!(e6.GameplayState == 3))
                {
                    e6.GameplayState = 3;
                    e6.AnimState     = 3;
                    e6.curFrame      = 0;
                    level.GetComponent <levelManager>().enemycount--;
                    AudioSource.PlayClipAtPoint(ed, new Vector3(0, 0, 0), vol);
                }
                else
                {
                    e6.GameplayState = 0;
                    e6.AnimState     = 0;
                    e6.curFrame      = 0;
                    e6.patterncount  = 0;
                    level.GetComponent <levelManager>().enemycount++;
                    e6.GetComponent <SpriteRenderer>().enabled = true;
                    e6.GetComponent <SpriteRenderer>().sprite  = e6.IdleAnimations[0];
                    AudioSource.PlayClipAtPoint(eu, new Vector3(0, 0, 0), vol);
                }
                Destroy(gameObject);
                return;
            }

            BossEnemy e8 = col.gameObject.GetComponent <BossEnemy>();
            if (e8 != null)
            {
                if (!(e8.GameplayState == 3))
                {
                    e8.GameplayState = 3;
                    e8.AnimState     = 3;
                    e8.curFrame      = 0;
                    level.GetComponent <levelManager>().enemycount--;
                    AudioSource.PlayClipAtPoint(ed, new Vector3(0, 0, 0), vol);
                }
                else
                {
                    e8.GameplayState = 0;
                    e8.AnimState     = 0;
                    e8.curFrame      = 0;
                    e8.patterncount  = 0;
                    level.GetComponent <levelManager>().enemycount++;
                    e8.GetComponent <SpriteRenderer>().enabled = true;
                    e8.GetComponent <SpriteRenderer>().sprite  = e8.IdleAnimations[0];
                    AudioSource.PlayClipAtPoint(eu, new Vector3(0, 0, 0), vol);
                }
                Destroy(gameObject);
                return;
            }
        }
    }
Пример #2
0
    public void startGame()
    {
        healthBar.SetActive(true);
        enemyhealthBar.SetActive(true);

        if (SceneManage.currentlySelectedCountry == 0)
        {
            newBall                    = Instantiate(Polandball);
            Enemy                      = Instantiate(Sovietball);
            Enemy2                     = Instantiate(Sovietball);
            Enemy3                     = Instantiate(Sovietball);
            OriHealth                  = GameObject.FindObjectOfType <Ball>().GetComponent <Ball>().health;
            EnemyHealth                = Enemy.GetComponent <Enemy>().health;
            Enemy2Health               = Enemy2.GetComponent <Enemy>().health;
            Enemy3Health               = Enemy3.GetComponent <Enemy>().health;
            oriEnemyHealth             = EnemyHealth + Enemy2Health + Enemy3Health;
            newBall.transform.position = new Vector3(-7f, 0.5f, 0f);
            Enemy.transform.position   = new Vector3(-3f, 0.5f, 0);
            Enemy2.transform.position  = new Vector3(5f, 1.4f, 0);
            Enemy3.transform.position  = new Vector3(5f, -1.4f, 0);
            enemycount                 = 3;
        }
        else if (SceneManage.currentlySelectedCountry == 1)
        {
            newBall     = Instantiate(Chinaball);
            Enemy       = Instantiate(Facebookball);
            OriHealth   = GameObject.FindObjectOfType <Ball>().GetComponent <Ball>().health;
            EnemyHealth = Enemy.GetComponent <Enemy>().health;
            newBall.transform.position = new Vector3(-7f, 0.5f, 0f);
            oriEnemyHealth             = EnemyHealth;
            enemycount = 1;
        }
        else if (SceneManage.currentlySelectedCountry == 2)
        {
            newBall      = Instantiate(SouthKoreaball);
            Enemy        = Instantiate(Nkball);
            Enemy2       = Instantiate(Nkball);
            Enemy3       = Instantiate(Nkball);
            OriHealth    = GameObject.FindObjectOfType <Ball>().GetComponent <Ball>().health;
            EnemyHealth  = Enemy.GetComponent <Enemy>().health;
            Enemy2Health = Enemy2.GetComponent <Enemy>().health;
            Enemy3Health = Enemy3.GetComponent <Enemy>().health;
            newBall.transform.position = new Vector3(-7f, 0.5f, 0f);
            Enemy.transform.position   = new Vector3(3.96f, 2.07f, 0);
            Enemy2.transform.position  = new Vector3(-7.03f, 2.74f, 0);
            Enemy3.transform.position  = new Vector3(-2.46f, -2.16f, 0);
            oriEnemyHealth             = EnemyHealth + Enemy2Health + Enemy3Health;
            enemycount = 3;
        }
        else if (SceneManage.currentlySelectedCountry == 3)
        {
            newBall      = Instantiate(Americaball);
            Enemy        = Instantiate(ISISball);
            Enemy2       = Instantiate(ISISball);
            Enemy3       = Instantiate(ISISball);
            OriHealth    = GameObject.FindObjectOfType <Ball>().GetComponent <Ball>().health;
            EnemyHealth  = Enemy.GetComponent <Enemy>().health;
            Enemy2Health = Enemy2.GetComponent <Enemy>().health;
            Enemy3Health = Enemy3.GetComponent <Enemy>().health;
            newBall.transform.position = new Vector3(-7f, 0.5f, 0f);
            Enemy.transform.position   = new Vector3(6.29f, -0.06f, 0);
            Enemy2.transform.position  = new Vector3(0.26f, 0.1f, 0);
            Enemy3.transform.position  = new Vector3(-4.11f, -4.27f, 0);
            oriEnemyHealth             = EnemyHealth + Enemy2Health + Enemy3Health;
            enemycount = 3;
        }
        else if (SceneManage.currentlySelectedCountry == 4)
        {
            newBall      = Instantiate(Canadaball);
            Enemy        = Instantiate(Fire);
            Enemy2       = Instantiate(Fire);
            Enemy3       = Instantiate(Fire);
            OriHealth    = GameObject.FindObjectOfType <Ball>().GetComponent <Ball>().health;
            EnemyHealth  = Enemy.GetComponent <Enemy>().health;
            Enemy2Health = Enemy2.GetComponent <Enemy>().health;
            Enemy3Health = Enemy3.GetComponent <Enemy>().health;
            newBall.transform.position = new Vector3(-7f, 0.5f, 0f);
            Enemy.transform.position   = new Vector3(-1.313f, 0.0562f, 0);
            Enemy2.transform.position  = new Vector3(1.7982f, 0.0562f, 0);
            Enemy3.transform.position  = new Vector3(4.6732f, 0.0562f, 0);
            oriEnemyHealth             = EnemyHealth + Enemy2Health + Enemy3Health;
            enemycount = 3;
        }
        else if (SceneManage.currentlySelectedCountry == 5)
        {
            newBall      = Instantiate(Britainball);
            Enemy        = Instantiate(Naziball);
            Enemy2       = Instantiate(Naziball);
            Enemy3       = Instantiate(Naziball);
            OriHealth    = GameObject.FindObjectOfType <Ball>().GetComponent <Ball>().health;
            EnemyHealth  = Enemy.GetComponent <Enemy>().health;
            Enemy2Health = Enemy2.GetComponent <Enemy>().health;
            Enemy3Health = Enemy3.GetComponent <Enemy>().health;
            newBall.transform.position = new Vector3(-7f, 0.5f, 0f);
            Enemy.transform.position   = new Vector3(-4.92f, 2.71f, 0);
            Enemy2.transform.position  = new Vector3(1.43f, 2.9f, 0);
            Enemy3.transform.position  = new Vector3(6.06f, -1.59f, 0);
            oriEnemyHealth             = EnemyHealth + Enemy2Health + Enemy3Health;
            enemycount = 3;
        }
        else if (SceneManage.currentlySelectedCountry == 6)
        {
            newBall      = Instantiate(SouthAfricaball);
            Enemy        = Instantiate(Italyball);
            Enemy2       = Instantiate(Italyball);
            Enemy3       = Instantiate(Italyball);
            OriHealth    = GameObject.FindObjectOfType <Ball>().GetComponent <Ball>().health;
            EnemyHealth  = Enemy.GetComponent <Enemy>().health;
            Enemy2Health = Enemy2.GetComponent <Enemy>().health;
            Enemy3Health = Enemy3.GetComponent <Enemy>().health;
            newBall.transform.position = new Vector3(-7f, 0.5f, 0f);
            Enemy.transform.position   = new Vector3(-1.313f, 0.0562f, 0);
            Enemy2.transform.position  = new Vector3(1.113f, 0.0562f, 0);
            Enemy3.transform.position  = new Vector3(7.378f, 2.035f, 0);
            oriEnemyHealth             = EnemyHealth + Enemy2Health + Enemy3Health;
            enemycount = 3;
        }
        else if (SceneManage.currentlySelectedCountry == 7)
        {
            newBall      = Instantiate(Germanyball);
            Enemy        = Instantiate(USball);
            Enemy2       = Instantiate(USball);
            Enemy3       = Instantiate(USball);
            OriHealth    = GameObject.FindObjectOfType <Ball>().GetComponent <Ball>().health;
            EnemyHealth  = Enemy.GetComponent <Enemy>().health;
            Enemy2Health = Enemy2.GetComponent <Enemy>().health;
            Enemy3Health = Enemy3.GetComponent <Enemy>().health;
            newBall.transform.position = new Vector3(-7f, 0.5f, 0f);
            Enemy.transform.position   = new Vector3(-4.28f, 1.8f, 0);
            Enemy2.transform.position  = new Vector3(0.171f, -0.239f, 0);
            Enemy3.transform.position  = new Vector3(4.016f, -3.426f, 0);
            oriEnemyHealth             = EnemyHealth + Enemy2Health + Enemy3Health;
            enemycount = 3;
        }
        else if (SceneManage.currentlySelectedCountry == 8)
        {
            newBall      = Instantiate(SovietUnionball);
            Enemy        = Instantiate(WinterNaziball);
            Enemy2       = Instantiate(WinterNaziball);
            Enemy3       = Instantiate(WinterNaziball);
            OriHealth    = GameObject.FindObjectOfType <Ball>().GetComponent <Ball>().health;
            EnemyHealth  = Enemy.GetComponent <Enemy>().health;
            Enemy2Health = Enemy2.GetComponent <Enemy>().health;
            Enemy3Health = Enemy3.GetComponent <Enemy>().health;
            newBall.transform.position = new Vector3(-7f, 0.5f, 0f);
            Enemy.transform.position   = new Vector3(0.06f, 2.33f, 0);
            Enemy2.transform.position  = new Vector3(0.188f, -3.116f, 0);
            Enemy3.transform.position  = new Vector3(3.53f, -0.07f, 0);
            oriEnemyHealth             = EnemyHealth + Enemy2Health + Enemy3Health;
            enemycount = 3;
        }
    }
Пример #3
0
 public void Enter(Enemy2 enemy1)
 {
     this.enemy = enemy1;
     animator   = enemy.GetComponent <Animator>();
     canattacc  = false;
 }
Пример #4
0
 public void Enter(Enemy2 enemy1)
 {
     this.enemy = enemy1;
     animator   = enemy.GetComponent <Animator>();
 }