protected override void Update()
    {
        base.Update();

        if (Vector3.Distance(position, targetTreasure.transform.position) < radius)
        {
            targetTreasure.OnGrab();
        }
    }
Beispiel #2
0
    protected override void Update()
    {
        base.Update();

        // If colliding with a treasure, activate the treasure's "on grab" method
        if (Vector3.Distance(position, targetTreasure.transform.position) < radius)
        {
            targetTreasure.OnGrab();
        }
    }