// Use this for initialization
    void Start()
    {
        largeBulletInstance = Instantiate(_largeBulletPrefab) as GameObject;
        largeBulletInstance.transform.position = _createBulletPosi;

        aEB = this.gameObject.GetComponent <allEnemyBase>();

        largeBulletInstance.GetComponent <NatureBullet_Shine3> ().setDealDamege(aEB.getAttackingPower() * _bulletDamageMagn);

        StartCoroutine(magicSouceMoving());

        StartCoroutine(mainLoop());
    }
Ejemplo n.º 2
0
    IEnumerator mainLoop()
    {
        while (true)
        {
            GameObject tmpGO = (GameObject)Instantiate(_taru_Prefabs);

            tmpGO.SetActive(true);
            tmpGO.transform.parent   = null;
            tmpGO.transform.position = this.transform.position;
            //投射セット
            tmpGO.GetComponent <bulletBase_CannotDestory>()._movingSpeedforSec = _throwRockVector;
            tmpGO.GetComponent <bulletBase_CannotDestory>().deleteTime         = 30f;

            float tmpDm = enemyBase.getAttackingPower() * 0.8f;
            tmpGO.GetComponent <bulletBase_CannotDestory> ().setDealDamage(tmpDm);

            yield return(new WaitForSeconds(_ganarateSec));
        }
    }
Ejemplo n.º 3
0
    void OnTriggerEnter2D(Collider2D c)
    {
        //void OnTriggerStay2D(Collider2D c){

        if (searchEnabledFlag)
        {
            if (c.gameObject.name.Substring(0, 9) == "charaBase")
            {
                _thunderColliderObject.SetActive(true);
                _thunderColliderObject.GetComponent <enemyThunderTowerCollider> ().setDamage(_allEnemyParent.getAttackingPower());

                searchEnabledFlag = false;
                _rotateParent.setFreezFlag(true);
                attackCircle.enabled = false;

                StartCoroutine(waitTime());

                _rotateParent.transform.rotation = Quaternion.identity;
                _rotateParent.transform.rotation = LookAt2D.lookAt(c.transform.position, _allEnemyParent.transform.position);

                StartCoroutine(colliderActiveWait());
            }
        }
    }
Ejemplo n.º 4
0
    IEnumerator mostNearEnemyAttacking()
    {
        Vector3   tmpV;
        float     minLength  = 99999f;
        Transform nearTarget = null;

        //再接近ターゲットの確認
        foreach (Transform t in lastFrameAttackTarget)
        {
            if (t != null)
            {
                tmpV = t.transform.position - this.transform.position;

                if (tmpV.magnitude < minLength)
                {
                    minLength  = tmpV.magnitude;
                    nearTarget = t;
                }
            }
        }

        if (nearTarget == null)
        {
            Debug.Log("isNull!!");
            yield break;
            //稀に破壊されてNullになるため
        }

        allCharaBase charaB = nearTarget.gameObject.GetComponent <allCharaBase> ();

        if (charaB.destroyF == true)
        {
            Debug.Log("isDestoryFlag!!");
            yield break;
        }

        lastFrameAttackTarget.Clear();
        deleyFlag = true;

        if (_animetionPrefabs != null)
        {
            //アニメーションがセットしてある場合
            _animetionPrefabs.enabled = true;
        }

        int tmpDm = 1 + Mathf.FloorToInt(aEB.getAttackingPower() + (Random.value * 2));

        charaB.setDamage(tmpDm);

        if (_attackEffectPrefab != null)
        {
            Instantiate(_attackEffectPrefab, nearTarget.transform.position, Quaternion.identity);
        }

        this.GetComponent <chara_attackEreaVisible>().setVisibleThisCicle();

        //ここで再取得
        thisEnemyAttackDeleySec = aEB.getAttackingDelay();

        StartCoroutine(this.attackDeleyClearer());
    }
    IEnumerator mostNearEnemyAttacking()
    {
        Vector3   tmpV;
        float     minLength  = 99999f;
        Transform nearTarget = null;

        //再接近ターゲットの確認
        foreach (Transform t in lastFrameAttackTarget)
        {
            if (t != null)
            {
                tmpV = t.transform.position - this.transform.position;

                if (tmpV.magnitude < minLength)
                {
                    minLength  = tmpV.magnitude;
                    nearTarget = t;
                }
            }
        }

        if (nearTarget == null)
        {
            Debug.Log("isNull!!");
            yield break;
            //稀に破壊されてNullになるため
        }

        allCharaBase charaB = nearTarget.gameObject.GetComponent <allCharaBase> ();

        if (charaB.destroyF == true)
        {
            Debug.Log("isDestoryFlag!!");
            yield break;
        }

        lastFrameAttackTarget.Clear();

        deleyFlag = true;

        //Debug.Log ("skill!!");

        wolfSkillAnimationPosition tmpPosiS = _animationBase.GetComponent <wolfSkillAnimationPosition> ();

        tmpPosiS.setTargetPosition(nearTarget.transform.position);
        tmpPosiS.startXPosition();


        Animator thisAnimetor = _animationBase.GetComponentInChildren <Animator>();

        thisAnimetor.SetTrigger("setSkill");

        _basicAttackCollider.enabled = false;           //通常攻撃の停止

        this.GetComponent <chara_attackEreaVisible>().setVisibleThisCicle();

        StartCoroutine(this.skillAttackWait(nearTarget.transform.position, aEB.getAttackingPower() * 2.1f));
        //Debug.Log ("1");
        StartCoroutine(this.basicAttackWait());
        //Debug.Log ("2");
        StartCoroutine(this.attackDeleyClearer());
        //Debug.Log ("3");
    }
Ejemplo n.º 6
0
    IEnumerator mainLoop()
    {
        while (true)
        {
            yield return(new WaitForSeconds(_genarateIntervalSec));

            //敵発見してない場合はやらない
            if (thisEnemy.charaFindFlag == true)
            {
                GameObject tmpGO = Instantiate(_throwBullet) as GameObject;
                tmpGO.transform.position = this.transform.position;

                enemyStandardMovingScript eTB = tmpGO.GetComponent <enemyStandardMovingScript> ();

                Vector3    tmpV      = this.transform.position;
                GameObject nearChara = GMS.getMostNearCharacter(tmpV);
                if (nearChara == null)
                {
                    yield break;
                }

                eTB.setMoveTypeTargetPosi(1, nearChara.transform.position - tmpV);

                tmpGO.transform.Find("AttackErea").GetComponent <damageErea>().setDealDamage(thisEnemy.getAttackingPower() * 0.8f);

                eTB.setDestoryMe(1f);
            }
        }
    }