Esempio n. 1
0
    void Update()
    {
        queen   = GameObject.FindGameObjectWithTag("Boss");
        enemies = GameObject.FindGameObjectWithTag("Enemy");
        flowers = GameObject.FindGameObjectWithTag("Flower");
        if (spawn.Level5 == true)
        {
            enemy = GameObject.FindGameObjectWithTag("Boss").GetComponent <Enemy4>();
        }

        if (hive == null)
        {
            MainMenu.SetActive(false);
            WinMenu.SetActive(false);
            controlMenu.SetActive(false);
            StartCoroutine(death());
        }

        if (Input.GetKey("escape") || Input.GetButton("Quit"))
        {
            Application.Quit();
            Debug.Log("quit");
        }

        if (enemy.dead == true)
        {
            MainMenu.SetActive(false);
            EndMenu.SetActive(false);
            controlMenu.SetActive(false);
            StartCoroutine(win());
        }
    }
Esempio n. 2
0
        public void SequentialEnemies()
        {
            String str = @"[
              { ""time"": 100, ""type"": 0, ""x"":10, ""y"": 60},
              { ""time"": 200, ""type"": 1, ""x"":20, ""y"": 70},
              { ""time"": 300, ""type"": 2, ""x"":30, ""y"": 80},
              { ""time"": 400, ""type"": 3, ""x"":40, ""y"": 90},
              { ""time"": 500, ""type"": 4, ""x"":50, ""y"": 100},
            ";
            Dictionary <int, List <AbstractEnemy> > story
                = ScenarioReader.Read(str);

            Assert.IsInstanceOfType(story[100][0], typeof(Enemy0));
            Assert.IsInstanceOfType(story[200][0], typeof(Enemy1));
            Assert.IsInstanceOfType(story[300][0], typeof(Enemy2));
            Assert.IsInstanceOfType(story[400][0], typeof(Enemy3));
            Assert.IsInstanceOfType(story[500][0], typeof(Enemy4));

            Enemy0 e0 = (Enemy0)story[100][0];
            Enemy1 e1 = (Enemy1)story[200][0];
            Enemy2 e2 = (Enemy2)story[300][0];
            Enemy3 e3 = (Enemy3)story[400][0];
            Enemy4 e4 = (Enemy4)story[500][0];

            Assert.AreEqual(10, e0.X);
            Assert.AreEqual(60, e0.Y);
            Assert.AreEqual(20, e1.X);
            Assert.AreEqual(70, e1.Y);
            Assert.AreEqual(30, e2.X);
            Assert.AreEqual(80, e2.Y);
            Assert.AreEqual(40, e3.X);
            Assert.AreEqual(90, e3.Y);
            Assert.AreEqual(50, e4.X);
            Assert.AreEqual(100, e4.Y);
        }
        private void PlaceEnemies(Double left, Double top)
        {
            Enemy1.Move(Enemy1.Left + left, Enemy1.Top + top);
            Enemy2.Move(Enemy1.Left + GameConfigurations.EnemyWidth * 1.5, Enemy1.Top);
            Enemy3.Move(Enemy2.Left + GameConfigurations.EnemyWidth * 1.5, Enemy1.Top);
            Enemy4.Move(Enemy3.Left + GameConfigurations.EnemyWidth * 1.5, Enemy1.Top);

            Enemy5.Move(Enemy1.Left * 1.5, Enemy1.Top + GameConfigurations.EnemyHeight * 1.5);
            Enemy6.Move(Enemy5.Left + GameConfigurations.EnemyWidth * 1.5, Enemy5.Top);
            Enemy7.Move(Enemy6.Left + GameConfigurations.EnemyWidth * 1.5, Enemy5.Top);
            Enemy8.Move(Enemy7.Left + GameConfigurations.EnemyWidth * 1.5, Enemy5.Top);

            Enemy9.Move(Enemy1.Left * 1.25, Enemy5.Top + GameConfigurations.EnemyHeight * 1.5);
            Enemy10.Move(Enemy9.Left + GameConfigurations.EnemyWidth * 1.5, Enemy9.Top);
            Enemy11.Move(Enemy10.Left + GameConfigurations.EnemyWidth * 1.5, Enemy9.Top);
            Enemy12.Move(Enemy11.Left + GameConfigurations.EnemyWidth * 1.5, Enemy9.Top);

            Enemy13.Move(Enemy1.Left * 1.5, Enemy10.Top + GameConfigurations.EnemyHeight * 1.5);
            Enemy14.Move(Enemy13.Left + GameConfigurations.EnemyWidth * 1.5, Enemy13.Top);
            Enemy15.Move(Enemy14.Left + GameConfigurations.EnemyWidth * 1.5, Enemy13.Top);
            Enemy16.Move(Enemy15.Left + GameConfigurations.EnemyWidth * 1.5, Enemy13.Top);

            Enemy17.Move(Enemy1.Left, Enemy13.Top + GameConfigurations.EnemyHeight * 1.5);
            Enemy18.Move(Enemy17.Left + GameConfigurations.EnemyWidth * 1.5, Enemy17.Top);
            Enemy19.Move(Enemy18.Left + GameConfigurations.EnemyWidth * 1.5, Enemy17.Top);
            Enemy20.Move(Enemy19.Left + GameConfigurations.EnemyWidth * 1.5, Enemy17.Top);
        }
Esempio n. 4
0
        public void Enemy4Movement()
        {
            ViewModel vm    = new ViewModel();
            int       seed  = 1;
            Enemy4    enemy = new Enemy4(200, 200, seed);

            vm.AddEnemy(enemy);
            Assert.AreEqual("ms-appx:///Images/enemy4.png",
                            enemy.Source.UriSource.AbsoluteUri);

            Random r = new Random(seed);

            for (int i = 0; i < 10; i++)
            {
                int    rx = r.Next(0, (int)(ViewModel.Field.Width - enemy.Width));
                int    ry = r.Next(0, (int)(ViewModel.Field.Height - enemy.Height));
                double dx = (rx - enemy.X) / 50.0;
                double dy = (ry - enemy.Y) / 50.0;
                double x  = enemy.X;
                double y  = enemy.Y;
                for (int j = 0; j < 50; j++)
                {
                    Assert.AreEqual(x + dx * j, enemy.X, 5);
                    Assert.AreEqual(y + dy * j, enemy.Y, 5);
                    vm.Tick(1);
                }
            }
            Assert.AreEqual(20, vm.TotalBullets);
        }
Esempio n. 5
0
 void Update()
 {
     rb     = GetComponent <Rigidbody2D>();
     boss   = GetComponent <Boss>();
     enemy2 = GetComponent <Enemy2>();
     enemy3 = GetComponent <Enemy3>();
     enemy4 = GetComponent <Enemy4>();
 }
 void Start()
 {
     enemy    = GetComponent <EnemyMove>();
     enemyBos = GetComponent <EnemyBos>();
     enemy2   = GetComponent <Enemy2>();
     enemy3   = GetComponent <Enemy3>();
     enemy4   = GetComponent <Enemy4>();
 }
Esempio n. 7
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     localScale = animator.transform.localScale;
     playerPos  = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
     rb         = animator.GetComponent <Rigidbody2D>();
     enemy4     = animator.GetComponent <Enemy4>();
     timer      = Random.Range(minTime, maxTime);
 }
Esempio n. 8
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.tag.Equals("Player") && !isByPlayerCreated)
        {
            Debug.Log("Collison with Player");

            Player player = col.gameObject.GetComponent <Player>();
            PlayerRecord.health -= damage;
            //Debug.Log("Life of player: " + PlayerRecord.health);
        }
        else if (isByPlayerCreated)
        {
            if (col.gameObject.tag.Equals("Enemy1"))
            {
                Debug.Log("Collison with Enemy1");

                Enemy1 enemy1 = col.gameObject.GetComponent <Enemy1>();
                enemy1.setHealth(enemy1.getHealth() - damage);
                //Debug.Log("Life of Enemy1: " + enemy1.getHealth());
            }

            else if (col.gameObject.tag.Equals("Enemy2"))
            {
                Debug.Log("Collison with Enemy2");

                Enemy2 enemy2 = col.gameObject.GetComponent <Enemy2>();
                enemy2.setHealth(enemy2.getHealth() - damage);
                //Debug.Log("Life of Enemy2: " + enemy2.getHealth());
            }
            else if (col.gameObject.tag.Equals("Enemy3"))
            {
                Debug.Log("Collison with Enemy3");

                Enemy3 enemy3 = col.gameObject.GetComponent <Enemy3>();
                enemy3.setHealth(enemy3.getHealth() - damage);
                //Debug.Log("Life of Enemy3: " + enemy3.getHealth());
            }
            else if (col.gameObject.tag.Equals("Enemy4"))
            {
                Debug.Log("Collison with Enemy4");

                Enemy4 enemy4 = col.gameObject.GetComponent <Enemy4>();
                enemy4.setHealth(enemy4.getHealth() - damage);
                //Debug.Log("Life of Enemy4: " + enemy4.getHealth());
            }
        }
        else if (col.gameObject.tag.Equals("FireBall"))
        {
            bool isByPlayerCreatedColFireBall = col.gameObject.GetComponent <FireBall>().getIsByPlayerCreated();
            if (isByPlayerCreated ^ isByPlayerCreatedColFireBall)
            {
                //Debug.Log("Fireball is destroyed");
                Destroy(col.gameObject);
                Destroy(gameObject);
            }
        }
    }
Esempio n. 9
0
    void Damage4(Transform enemy3)
    {
        Enemy4 e = enemy3.GetComponent <Enemy4>();

        if (e != null)
        {
            e.TakeDamage(BulletDamage);
        }
    }
Esempio n. 10
0
    void OnTriggerEnter2D(Collider2D hitInfo)
    {
        Enemy enemy = hitInfo.GetComponent <Enemy>();

        if (enemy != null)
        {
            enemy.TakeDamage(damage);
            Destroy(gameObject);
        }

        Enemy2 enemy2 = hitInfo.GetComponent <Enemy2>();

        if (enemy2 != null)
        {
            enemy2.TakeDamage(damage);
            Destroy(gameObject);
        }

        Enemy3 enemy3 = hitInfo.GetComponent <Enemy3>();

        if (enemy3 != null)
        {
            enemy3.TakeDamage(damage);
            Destroy(gameObject);
        }

        Enemy4 enemy4 = hitInfo.GetComponent <Enemy4>();

        if (enemy4 != null)
        {
            enemy4.TakeDamage(damage);
            Destroy(gameObject);
        }

        Boss1 boss1 = hitInfo.GetComponent <Boss1>();

        if (boss1 != null)
        {
            boss1.TakeDamage(damage);
            Destroy(gameObject);
        }

        Boss2 boss2 = hitInfo.GetComponent <Boss2>();

        if (boss2 != null)
        {
            boss2.TakeDamage(damage);
            Destroy(gameObject);
        }
    }
Esempio n. 11
0
        static internal Dictionary <int, List <AbstractEnemy> > Read(String content)
        {
            Dictionary <int, List <AbstractEnemy> > story
                = new Dictionary <int, List <AbstractEnemy> >();

            var json = (dynamic)JsonConvert.DeserializeObject(content);

            foreach (var e in json)
            {
                long time = e["time"].Value;
                long type = e["type"].Value;
                long x    = e["x"].Value;
                long y    = e["y"].Value;
                long sx   = e["sx"]?.Value ?? 0;
                long sy   = e["sy"]?.Value ?? 0;

                AbstractEnemy enemy = null;
                switch (type)
                {
                case 0: enemy = new Enemy0(x, y); break;

                case 1: enemy = new Enemy1(x, y); break;

                case 2:
                    double t = sx > 0 ? -1 : +1;
                    enemy = new Enemy2(x, y, sx, sy, t);
                    break;

                case 3: enemy = new Enemy3(x, y); break;

                case 4: enemy = new Enemy4(x, y); break;
                }

                List <AbstractEnemy> enemies;
                if (story.ContainsKey((int)time))
                {
                    enemies = story[(int)time];
                }
                else
                {
                    enemies          = new List <AbstractEnemy>();
                    story[(int)time] = enemies;
                }

                enemies.Add(enemy);
            }
            return(story);
        }
Esempio n. 12
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Boss")
     {
         GetComponent <Animator>().SetTrigger("impact");
         rb.velocity = transform.right * 0;
         GameObject gO = collision.gameObject;
         boss = gO.GetComponent <Boss>();
         float damage = PlayerPrefs.GetFloat("playerDamge");
         boss.SendMessageUpwards("Damage", damage);
         boss.gO(gO);
     }
     else if (collision.tag == "Enemy2")
     {
         GetComponent <Animator>().SetTrigger("impact");
         rb.velocity = transform.right * 0;
         GameObject gO = collision.gameObject;
         enemy2 = gO.GetComponent <Enemy2>();
         float damage = PlayerPrefs.GetFloat("playerDamge");
         enemy2.SendMessageUpwards("Damage", damage);
         enemy2.gO(gO);
     }
     else if (collision.tag == "Enemy3")
     {
         GetComponent <Animator>().SetTrigger("impact");
         rb.velocity = transform.right * 0;
         GameObject gO = collision.gameObject;
         enemy3 = gO.GetComponent <Enemy3>();
         float damage = PlayerPrefs.GetFloat("playerDamge");
         enemy3.SendMessageUpwards("Damage", damage);
         enemy3.gO(gO);
     }
     else if (collision.tag == "Enemy4")
     {
         GetComponent <Animator>().SetTrigger("impact");
         rb.velocity = transform.right * 0;
         GameObject gO = collision.gameObject;
         enemy4 = gO.GetComponent <Enemy4>();
         float damage = PlayerPrefs.GetFloat("playerDamge");
         enemy4.SendMessageUpwards("Damage", damage);
         enemy4.gO(gO);
     }
 }
Esempio n. 13
0
        /// <summary>
        ///
        /// </summary>
        public GameModel()
        {
            GameModel.XDistanceBetweenSprites    = 100;
            GameModel.YDistanceBetweenSprites    = 300;
            GameModel.YDistanceBetweenStars      = 50;
            GameModel.YDistanceBetweenStars      = 200;
            GameModel.YDistanceBetweenBlueStars  = 50;
            GameModel.YDistanceBetweenSmallStars = 200;
            GameModel.LeftDisplayBorder          = 50;
            GameModel.RightDisplayBorder         = 200;
            GameModel.BottomDisplayBorder        = 140;

            _background = new Background();

            _enemies[0] = new Enemy1(4, 3);
            _enemies[1] = new Enemy2(4, 3);
            _enemies[2] = new Enemy3(4, 3);
            _enemies[3] = new Enemy4(4, 3);

            _spaceShip = new AnimatedSprite(5, 4);

            for (int i = 0; i < _meteors.Length; i++)
            {
                _meteors[i] = new Meteor(9, 8);
            }

            for (int i = 0; i < _stars.Length; i++)
            {
                _stars[i]       = new Star(15, 7);
                _stars[i].Speed = new Vector2(0, 0.5f);
            }

            for (int i = 0; i < _fastStars.Length; i++)
            {
                _fastStars[i]       = new Star(15, 10);
                _fastStars[i].Speed = new Vector2(0, 1f);
            }

            _InitializeLives();

            _progress = new ProgressSprite();
        }
Esempio n. 14
0
    public void createEnemy4()
    {
        float initialeYPosition = Random.Range(groundTopY + enemy4Height, topCameraBorder - enemy4Height);

        if (Random.Range(0, 2) == 0)
        {
            Enemy4 enemy4 = Instantiate(GameObject.Find("Enemy4").GetComponent <Enemy4>(),
                                        new Vector3(leftBorderX, initialeYPosition, 0.0f), Quaternion.identity);

            enemy4.transform.rotation = new Quaternion(0, 0, 0, 0);
            enemy4.setDirection(1);
        }
        else
        {
            Enemy4 enemy4 = Instantiate(GameObject.Find("Enemy4").GetComponent <Enemy4>(),
                                        new Vector3(rightBorderX, initialeYPosition, 0.0f), Quaternion.identity);

            enemy4.transform.rotation = new Quaternion(0, 180, 0, 0);
            enemy4.setDirection(-1);
        }
    }
Esempio n. 15
0
        public void Enemy4DeadWithManyBullets()
        {
            ViewModel vm    = new ViewModel();
            Enemy4    enemy = new Enemy4(200, 200);

            vm.AddEnemy(enemy);
            Bullet b;

            Assert.IsTrue(enemy.IsValid);
            for (int i = 0; i < 19; i++)
            {
                b = new Bullet(enemy.X + enemy.Width / 2, enemy.Y + enemy.Height / 2);
                vm.AddBullet(b);
                vm.Tick(1);
            }

            Assert.IsTrue(enemy.IsValid);
            b = new Bullet(enemy.X + enemy.Width / 2, enemy.Y + enemy.Height / 2);
            vm.AddBullet(b);
            vm.Tick(1);
            Assert.IsFalse(enemy.IsValid);
        }
Esempio n. 16
0
    private void OnTriggerEnter2D(Collider2D collider)
    {
        if (collider.GetComponent <AreaCamera>() == null &&
            collider.GetComponent <Player>() == null) // Não é uma câmera nem o Player
        {
            Enemy1 enemy1 = collider.GetComponent <Enemy1>();
            Enemy2 enemy2 = collider.GetComponent <Enemy2>();
            Enemy3 enemy3 = collider.GetComponent <Enemy3>();
            Enemy4 enemy4 = collider.GetComponent <Enemy4>();
            Boss   boss   = collider.GetComponent <Boss>();
            if (enemy1 != null) // É um inimigo
            {
                enemy1.TakeDamage(bulletDamage);
            }
            else if (enemy2 != null)
            {
                enemy2.TakeDamage(bulletDamage);
            }
            else if (enemy3 != null)
            {
                enemy3.TakeDamage(bulletDamage);
            }
            else if (enemy4 != null)
            {
                enemy4.TakeDamage(bulletDamage);
            }
            else if (boss != null)
            {
                boss.TakeDamage(bulletDamage);
            }

            Destroy(gameObject);

            Instantiate(impactEffect, transform.position, transform.rotation);
        }
    }
Esempio n. 17
0
 public E4_PlayerDetectedState(Entity entity, FiniteStateMachine stateMachine, string animBoolName, D_PlayerDetected stateData, Enemy4 enemy) : base(entity, stateMachine, animBoolName, stateData)
 {
     this.enemy = enemy;
 }
Esempio n. 18
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     enemy1 = animator.GetComponent <Enemy4>();
 }
Esempio n. 19
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;
            }
        }
    }
Esempio n. 20
0
 private void Start()
 {
     parent = GetComponentInParent <Enemy4>();
 }
 public void SetEnemy4(Enemy4 enemy4)
 {
     //this.enmey2 = enemy2;
     this.enemy4 = enemy4;
 }
Esempio n. 22
0
 public E4_IdleState(Entity entity, FiniteStateMachine stateMachine, string animBoolName, D_IdleState stateData, Enemy4 enemy) : base(entity, stateMachine, animBoolName, stateData)
 {
     this.enemy = enemy;
 }
Esempio n. 23
0
 private void Start()
 {
     _enemy4Script = Enemy4.GetComponent <Enemy4>();
 }
 private void Start()
 {
     _gameManager  = GameObject.Find("Game Manager").GetComponent <GameManager>();
     _enemy4Script = Enemy4.GetComponent <Enemy4>();
 }
Esempio n. 25
0
    /// <summary>
    ///	单个敌人实例化
    /// </summary>
    public void NewEmeny(int i)
    {
        if (i == 1)
        {
            Emeny1 Newemeny = new Emeny1();
            Newemeny.initdate();
            EnemyHp       = Newemeny.GetHp;
            Agi           = Newemeny.Agi;
            Avd           = Newemeny.Avd;
            TextName.text = Newemeny.GetName;
            // enemyAi[0]=Newemeny;
            Headportrait = Newemeny.GetHeadportrait;
        }
        else if (i == 2)
        {
            Emeny2 Newemeny = new Emeny2();
            Newemeny.initdate();
            EnemyHp       = Newemeny.GetHp;
            TextName.text = Newemeny.GetName;
            Agi           = Newemeny.Agi;
            Avd           = Newemeny.Avd;
            Headportrait  = Newemeny.GetHeadportrait;
            // enemyAi[0]=Newemeny;
        }
        else if (i == 3)
        {
            Enemy3 Newemeny = new Enemy3();
            Newemeny.initdate();
            EnemyHp       = Newemeny.GetHp;
            Avd           = Newemeny.Avd;
            Agi           = Newemeny.Agi;
            Headportrait  = Newemeny.GetHeadportrait;
            TextName.text = Newemeny.GetName;
            // double [] b={0};
            // Debug.Log(enemyAi);
            // enemyAi[0]=Newemeny;
            enemyAi.Add(Newemeny);
        }
        else if (i == 4)
        {
            Enemy4 Newemeny = new Enemy4();
            Newemeny.initdate();
            EnemyHp       = Newemeny.GetHp;
            Headportrait  = Newemeny.GetHeadportrait;
            Agi           = Newemeny.Agi;
            Avd           = Newemeny.Avd;
            TextName.text = Newemeny.GetName;
            enemyAi.Add(Newemeny);
        }
        else if (i == 5)
        {
            Enemy5 Newemeny = new Enemy5();
            Newemeny.initdate();
            EnemyHp       = Newemeny.GetHp;
            Agi           = Newemeny.Agi;
            Avd           = Newemeny.Avd;
            Headportrait  = Newemeny.GetHeadportrait;
            TextName.text = Newemeny.GetName;
            enemyAi.Add(Newemeny);
        }
        else if (i == 6)
        {
            Enemy6 Newemeny = new Enemy6();
            Newemeny.initdate();
            EnemyHp       = Newemeny.GetHp;
            Agi           = Newemeny.Agi;
            Avd           = Newemeny.Avd;
            Headportrait  = Newemeny.GetHeadportrait;
            TextName.text = Newemeny.GetName;
            enemyAi.Add(Newemeny);
        }
        else if (i == 99)
        {
            Enemy99 Newemeny = new Enemy99();
            Newemeny.initdate();
            EnemyHp       = Newemeny.GetHp;
            Agi           = Newemeny.Agi;
            Avd           = Newemeny.Avd;
            Headportrait  = Newemeny.GetHeadportrait;
            TextName.text = Newemeny.GetName;
            // double [] b={0};
            Debug.Log(enemyAi);
            // enemyAi[0]=Newemeny;
            enemyAi.Add(Newemeny);
        }

        else
        {
            Debug.Log("Input wrong!The enmey" + i + " no Found!");
        }
        if (EnemyHp != 0)
        {
            EnemyMaxHp = EnemyHp;
            Update_HpSlider(EnemyMaxHp, EnemyHp);
        }
    }
Esempio n. 26
0
 public E4_ShootAttackState(Entity entity, FiniteStateMachine stateMachine, string animBoolName, Transform attackPosition, D_ShootAttack stateData, Enemy4 enemy) : base(entity, stateMachine, animBoolName, attackPosition, stateData)
 {
     this.enemy = enemy;
 }