Exemplo n.º 1
0
 public DataFarmerObject(string tag)
 {
     this.tag         = tag;
     this.timestamp   = Time.time;
     ps               = ParticipantStatus.GetInstance();
     this.participant = ps.GetParticipant();
     this.trial       = ps.GetTrial();
     this.condition   = ps.GetCondition();
     this.category    = ps.GetCategory();
     this.cube        = ps.GetCube();
 }
    // makes a cube from a description of the 3 axes
    // for a description of this see ColorShapeRotation.cs
    // a CubeTuple describes a cube
    // mapping of cubes to categories is stored externally
    // as json data
    // for any participant we pick one set of mappings
    // and go through them somewhat randomly

    // I guess this is the current version of the "nice function"
    // this pulls the materials based on what we get for
    // the externally generated counterbalancing conditions
    // and maps the materials to the raw cube
    Material[] createSet()
    {
        CubeTuple c = ParticipantStatus.GetInstance().GetCube();

        Material[] matlist = rend.materials;
        matlist[0] = material[0];
        foreach (ColorShapeRotation csr in c.cube)
        {
            foreach (int face in csr.GetFaces())
            {
                matlist[face] = material[csr.GetMaterial()];
            }
        }
        return(matlist);
    }
    // makes a cube from a description of the 3 axes
    // for a description of this see ColorShapeRotation.cs
    // a CubeTuple describes a cube
    // mapping of cubes to categories is stored externally
    // as json data
    // for any participant we pick one set of mappings
    // and go through them somewhat randomly
    // this pulls the materials based on what we get for
    // the externally generated counterbalancing conditions
    // and maps the materials to the raw cube
    Material[] createSet()
    {
        // a CubeTuple is the 3 axes of the cube
        CubeTuple c = ParticipantStatus.GetInstance().GetCube();

        Material[] matlist = rend.materials;

        // this is the basic background material for the cube
        matlist[0] = material[0];

        // ColorShapeRotation describes one of the axes of the cube
        foreach (ColorShapeRotation csr in c.cube)
        {
            // we dress the two faces for the axis with the appropriate material
            foreach (int face in csr.GetFaces())
            {
                matlist[face] = material[csr.GetMaterial()];
            }
        }
        return(matlist);
    }
Exemplo n.º 4
0
    public List <CubeTuple> Shuffle(ParticipantStatus.Condition condition)
    {
        List <List <ColorShapeRotation> > arr = Cubesets[condition.cubeset][condition.catmap];

        CubeTuple[] shuffled = new CubeTuple[arr.Count];
        int         i        = 0;

        foreach (var c in arr)
        {
            shuffled[i] = new CubeTuple(c);
            i++;
        }
        System.Random random = new System.Random();
        for (i = 0; i < arr.Count; i++)
        {
            var replace = random.Next(arr.Count);
            var temp    = shuffled[replace];
            shuffled[replace] = shuffled[i];
            shuffled[i]       = temp;
        }
        return(new List <CubeTuple>(shuffled));
    }