예제 #1
0
 void SetVec()
 {
     vecCnt++;
     if (vecCnt % 2 == 0)
     {
         vec = EnemyNavigator.NavVec(transform.position, -0.7F, -0.5F);
     }
     else
     {
         vec = EnemyNavigator.NavVec(transform.position, 0.5F, 0.7F);
     }
 }
예제 #2
0
    void SetVec()
    {
        vecCnt++;
        if (vecCnt % 2 == 0)
        {
            vec = EnemyNavigator.NavVec(transform.position, -0.7F, -0.5F);
        }
        else
        {
            vec = EnemyNavigator.NavVec(transform.position, 0.5F, 0.7F);
        }

        float dist = (transform.position - player.transform.position).magnitude;

        if (dist > 7F)
        {
            vec *= 1F + (dist - 7F) * 0.15F;
        }
    }
예제 #3
0
    void ResetVec()
    {
        navVec = EnemyNavigator.NavVec(transform.position);
        float randAngle;

        if ((player.transform.position - transform.position).magnitude >= 4F)
        {
            randAngle = Random.Range(0.5F, 0.7F);
        }
        else
        {
            randAngle = Random.Range(0.45F, 0.55F) * Mathf.PI;
        }
        if (moveCnt % 2 == 1)
        {
            randAngle = -randAngle;
        }
        moveCnt++;
        vec = EnemyNavigator.NavVec(transform.position, randAngle) * basicSpeed;
    }
예제 #4
0
    private void FixedUpdate()
    {
        float dist = (player.transform.position - transform.position).magnitude;

        if (dist >= 4F)
        {
            vec = EnemyNavigator.NavVec(transform.position) * basicSpeed * speedRate;
        }
        else
        {
            vec = Vector2.zero;
        }
        if (Time.time >= lastShootTime + 4F && dist <= 5F)
        {
            StartCoroutine(ShootCoroutine());
        }
        if (!ec.stunned)
        {
            body.AddForce(vec);
        }
        UpdateDirection();
    }