Exemplo n.º 1
0
    void KeepAway(Unit target)
    {
        float look = Vector.ForwardSignedAngle(transform, target.position + V3Random.DirectionXz());

        destination.rotation = Quaternion.Euler(0, euler.y + look, 0);
        ChangeMovingRange(look);
        destination.position = HitMoveBorder(-destination.forward).point;
    }
Exemplo n.º 2
0
    void Chase(Unit target)
    {
        float look = Vector.ForwardSignedAngle(transform, target.position + V3Random.DirectionXz());

        destination.rotation = Quaternion.Euler(0, euler.y + look, 0);
        ChangeMovingRange(look);
        RaycastHit border     = HitMoveBorder(destination.forward);
        float      randomDist = Distance(target) - Random.Range(weapon.near, weapon.far);
        float      moveDist   = Mathf.Min(border.distance, randomDist);

        destination.position = position + destination.forward * moveDist;
    }