Esempio n. 1
0
    IEnumerator BulletRoutine()
    {
        while (isTargetingPlayer)
        {
            if (G20_GameManager.GetInstance().gameState != G20_GameState.INGAME || owner.HP <= 0)
            {
                RecvDamage(HP, G20_DamageType.System);
            }
            transform.Translate(moveVec * moveSpeed * Time.deltaTime, Space.World);
            //transform.Rotate(-100.0f*Time.deltaTime*moveSpeed,0,0);
            if (radius >= Vector3.Distance(Camera.main.transform.position, transform.position))
            {
                G20_EnemyAttack.GetInstance().Attack(1);
                RecvDamage(HP, G20_DamageType.System);
            }
            yield return(null);
        }
        particle.SetActive(false);
        gameObject.layer = LayerMask.NameToLayer(diedLayer);
        var rh = GetComponent <Rigidbody>();

        rh.isKinematic = false;
        var vec = transform.position - Camera.main.transform.position;

        rh.AddForce(vec * rollingPower, ForceMode.Impulse);
        yield return(new WaitForSeconds(rollingDuration));

        Destroy(gameObject);
    }
Esempio n. 2
0
    IEnumerator BombthrowCoroutine(float attackRange, int damage)
    {
        isThrowing = true;
        Vector3 moveVec = Vector3.zero;

        while (true)
        {
            init_v             -= gravity * Time.deltaTime;
            moveVec.y           = init_v;
            transform.position += moveVec * Time.deltaTime;


            distanceVec   = target.transform.position - transform.position;
            moveVec       = distanceVec.normalized;
            distanceVec.y = 0;
            distance      = distanceVec.magnitude;
            if (distance < attackRange)
            {
                G20_EnemyAttack.GetInstance().Attack(damage);
                Destroy(this.gameObject);
            }

            yield return(null);
        }
    }
    IEnumerator AttackCoroutine()
    {
        if (G20_GameManager.GetInstance().gameState != G20_GameState.INGAME)
        {
            //Debug.Log("インゲーム状態を抜けたのでAIを終了");
            yield break;
        }

        //Debug.Log("攻撃中");
        G20_EnemyAttack.GetInstance().Attack(enemy.Attack);
        // Debug.Log("攻撃終了");
    }
    IEnumerator AttackCoroutine()
    {
        if (G20_GameManager.GetInstance().gameState != G20_GameState.INGAME)
        {
            //Debug.Log("インゲーム状態を抜けたのでAIを終了");
            yield break;
        }
        //Debug.Log("攻撃中");
        animPlayer.PlayAnimation(G20_AnimType.Attack);

        yield return(new WaitForSeconds(attacktime / enemy.Speed));

        if (!enemy.IsLife)
        {
            yield break;
        }
        G20_EnemyAttack.GetInstance().Attack(enemy.Attack);
    }
Esempio n. 5
0
 IEnumerator AppleFlyRoutine()
 {
     while (G20_GameManager.GetInstance().gameState == G20_GameState.INGAME && isTargeting)
     {
         moveVec.y -= gravity * Time.deltaTime;
         transform.Translate(moveVec * enemy.Speed * Time.deltaTime, Space.World);
         transform.up = moveVec;
         appleModel.Rotate(0, 360 * spinSpeed * Time.deltaTime, 0);
         if (radius >= Vector3.Distance(Camera.main.transform.position, transform.position))
         {
             G20_EnemyAttack.GetInstance().Attack(enemy.Attack);
             yield return(StartCoroutine(SusideCoroutine()));
         }
         if (deathposition_y >= transform.position.y)
         {
             yield return(StartCoroutine(SusideCoroutine()));
         }
         yield return(null);
     }
 }