How to make this in to code C# :)

Actually just create a game management object that stores the script with the possible color of the player stored as an integer 1, 2 or 3
each one corresponding with a certain color
each time the player touches a the object assign a new number to him by randomly selecting a number between 1 or 3 and then change his color based on that
use an if statement if player color == object color then += 1 point,
player color = new color 1 - 3
send message to player
with color

There’s more than one question here, so I’ll give you some hints.

You can store your numbered colours as a Dictionary, like :

private Dictionary<int, Color> _numberedColors = new Dictionary<int, Color>();

Then, you can randomly get a Color from the Dictionary using Random.Range() like this:

public Color GetRandomColor ()
    return _numberedColors[Random.Range(0, _numberedColors.Count-1)];

Not sure what you mean by Player touches the object, but if you mean a 3D object player collides with the object, you need to add a Collider to both, and in that same script, add :

void OnCollisionEnter (Collision col)
    if (col.gameObject.tag == "Player")
        col.gameObject.SendMessage ("ColorObjectHit", GetRandomColor ());

Then, the ColorObjectHit method on PlayerScript object would look like this :

void ColorObjectHit (Color color)
    if (color == myColor)
        myColor = color;