Hello Xiu,
Now I want to pass a property from 1 player instance to 1 FieldItem instance.
If I understood your application case correctly, you have two objects: Player and FieldItem and you want to assign to the FieldItem a value from the Player object. Assuming the corresponding values are stored as properties in the Player and the FieldItem class, the following code could be adequate:
FieldItemObject.SomeProperty = PlayerObject.SomeProperty;
Each time the above code is executed, the actual value of the property from the PlayerObject is assigned (copied) to the FieldItemObject. This expects that the code is execute just in the momenent when you want the value to be transferred. Is this what you are trying to achieve?
Other approach would be to connect PlayerObject with the FieldItemObject. In this case, the FieldItemObject would store a reference to a property existing in the PlayerObject. Consequently, the FieldItemObject can access (read or modify) the referenced property 'remotely' whenever it is required. This approach expects that the property in the FieldItem class is declared to be able to store a reference to another property. For example, if you want to store in the property a reference to an int32 property, the property has to be declared with type ^int32 - note the leading ^ sign. Then you can store a reference to an int32 property inside this property:
FieldItemObject.SomeProperty = ^PlayerObject.SomeProperty;
The implementation in the FieldItem class can thereupon read and modify the referenced property. Please note again the usage of the ^ sign. It de-references the reference resulting in an access to the property:
// Inside FieldItem class
// Modify the referenced property
SomeProperty^ = 1234;
[...]
// Use the referenced property
DoSomething( SomeProperty^ );
I hope it helps you further. See also the chapter Implementing component interface.
Best regards
Paul Banach