GIVING variables to another gameobject

HAI!
I have two gameobjects, for example, powerup and player. Player and powerup have the same variables, for example:

var health : float;
var shield : bool;
var ammo : int;

I’m looking for a script, that, when player x,z position (y does not matter, 2d game) is the same as powerup x,z position, copies variables values FROM powerup, and gives it TO player. The script should be attached to powerup.
I thought about something like reverse GetComponent (GiveComponent?).

Waiting for your reply, Kisiel

This would require the “OtherObject” having a “OtherComponent” script attached that also has a variable named shared that is public.

One example:

public class ObjectComponent : MonoBehaviour
{

    public int shared = 10;

    void Awake()
    {

        GameObject.Find("OtherObject").GetComponent<OtherComponent>().shared = this.shared;

    }

}

you could put:

var sharedvalue : int;

function Update()
{
sharedvalue = otherscriptname.varname;
}