Exemple #1
0
    private IEnumerator Delete(float time)
    {
        yield return(new WaitForSeconds(time));

        DebugLogger.WriteInfo("Beetle.Delete IsBonus = {0}", IsBonus);
        if (IsBonus)
        {
            int type = UnityEngine.Random.Range(0, 7);
            var gem  = EGHelpers.CreateAnimationByScript <Gem>(__Transform.position,
                                                               GameManager.Instance.gemBonusAnims[type], "GemBonus" + type.ToString(), __Transform.parent,
                                                               GameLevel.NeutralTagName);
            gem.Kind = (GemType)type;
        }
        Destroy(gameObject);
        _Dead(0);
        _DiedObject = null;
    }
Exemple #2
0
    protected override void CreateEnemy()
    {
        ++_count;

        if (Level == 0)
        {
            var enemy = EGHelpers.CreateObjectByPrefab <Monster>(__Transform.localPosition,
                                                                 GameManager.Instance.GetMonoGameLevel().prefabSmallMonster, __Transform.parent);
            StartCoroutine(OnCreateEnemy(enemy));
            enemy.Speed = Random.Range(0.3f, 0.5f);
            enemy.SetMoveDirection(Random.Range(-1.0f, 1.0f), Random.Range(-1.0f, 1.0f));
            return;
        }

        if (Level == 1)
        {
            var enemy = EGHelpers.CreateObjectByPrefab <Monster>(__Transform.localPosition,
                                                                 GameManager.Instance.GetMonoGameLevel().prefabTendrils, __Transform.parent);
            StartCoroutine(OnCreateEnemy(enemy));
            enemy.Level = _count % 3 == 0 ? 1 : 0;
            enemy.Speed = Random.Range(0.4f, 0.6f);
            enemy.SetMoveDirection(Random.Range(-1.0f, 1.0f), Random.Range(-1.0f, 1.0f));
            return;
        }

        if (Level == 2)
        {
            if (_count % 3 == 0)
            {
                var intMouth = EGHelpers.CreateAnimationByScript <IntelligentMouth>(__Transform.localPosition,
                                                                                    animatorMouth, "IntelligentMouth", __Transform.parent, GameLevel.EnemyTagName);
                StartCoroutine(OnCreateEnemy(intMouth));
                intMouth.Speed = Random.Range(0.4f, 0.5f);
                return;
            }

            var enemy = EGHelpers.CreateObjectByPrefab <Monster>(__Transform.localPosition,
                                                                 GameManager.Instance.GetMonoGameLevel().prefabMouth, __Transform.parent);
            StartCoroutine(OnCreateEnemy(enemy));
            enemy.Speed = Random.Range(0.3f, 0.5f);
            enemy.SetMoveDirection(Random.Range(-1.0f, 1.0f), Random.Range(-1.0f, 1.0f));
            return;
        }

        if (Level == 3)
        {
            if (_count % 3 == 0)
            {
                var intMouth = EGHelpers.CreateAnimationByScript <IntelligentMouth>(__Transform.localPosition,
                                                                                    animatorMouth, "IntelligentMouth", __Transform.parent, GameLevel.EnemyTagName);
                StartCoroutine(OnCreateEnemy(intMouth));
                intMouth.Speed = Random.Range(0.4f, 0.6f);
                return;
            }

            var enemy = EGHelpers.CreateObjectByPrefab <Monster>(__Transform.localPosition,
                                                                 GameManager.Instance.GetMonoGameLevel().prefabMouth, __Transform.parent);
            StartCoroutine(OnCreateEnemy(enemy));
            enemy.Speed = Random.Range(0.4f, 0.7f);
            enemy.SetMoveDirection(Random.Range(-1.0f, 1.0f), Random.Range(-1.0f, 1.0f));
            return;
        }

        if (Level == 4)
        {
            /*int ost = count % 3;
             * if (ost == 0) {
             * var intMouth = EGHelpers.CreateAnimationByScript<IntelligentMouth>(__Transform.localPosition,
             *               animatorMouth, "IntelligentMouth", __Transform.parent, GameLevel.EnemyTagName);
             * StartCoroutine(OnCreateEnemy(intMouth));
             * intMouth.AddObserver(_DiedEnemy);
             * intMouth.Speed = Random.Range(0.4f, 0.6f);
             * return;
             * }
             *
             * if (ost == 1) {
             * var intMouth = EGHelpers.CreateAnimationByScript<IntelligentMouth>(__Transform.localPosition,
             *               animatorMouth, "IntelligentMouth", __Transform.parent, GameLevel.EnemyTagName);
             * StartCoroutine(OnCreateEnemy(intMouth));
             * intMouth.AddObserver(_DiedEnemy);
             * intMouth.Speed = Random.Range(0.4f, 0.6f);
             * return;
             * }*/

            var enemy = EGHelpers.CreateObjectByPrefab <Beetle>(__Transform.localPosition,
                                                                GameManager.Instance.GetMonoGameLevel().prefabBeetle, __Transform.parent);
            StartCoroutine(OnCreateEnemy(enemy));
            enemy.Speed = Random.Range(0.3f, 0.5f);
            enemy.SetMoveDirection(Random.Range(-1.0f, 1.0f), Random.Range(-1.0f, 1.0f));
            return;
        }

        if (Level == 5)
        {
            var enemy = EGHelpers.CreateObjectByPrefab <Beetle>(__Transform.localPosition,
                                                                GameManager.Instance.GetMonoGameLevel().prefabBeetle, __Transform.parent);
            StartCoroutine(OnCreateEnemy(enemy));
            enemy.Level = 1;
            enemy.Speed = Random.Range(0.3f, 0.5f);
            enemy.SetMoveDirection(Random.Range(-1.0f, 1.0f), Random.Range(-1.0f, 1.0f));
            return;
        }
    }