Exemplo n.º 1
0
    private void FixedUpdate()
    {
        float angle = EnemyNavigator.NavAng(transform.position);

        angle += theta;
        vec    = new Vector2(Mathf.Cos(angle), Mathf.Sin(angle)) * basicSpeed * speedRate;
        UpdateDirection();
        UpdateTheta();
        if (!ec.stunned)
        {
            body.AddForce(vec);
        }
    }
Exemplo n.º 2
0
    void ResetVec()
    {
        if ((player.transform.position - transform.position).magnitude <= 4F)
        {
            Split();
        }

        speed = basicSpeed * Random.Range(0.5F, 1.5F);

        angle = EnemyNavigator.NavAng(transform.position);
        float randAngle = Random.Range(0.5F, 0.7F);

        if (moveCnt % 2 == 1)
        {
            randAngle = -randAngle;
        }
        moveCnt++;
        angle += randAngle;
    }