Example #1
0
    private void SetElements(CompleteCaseEvaluation caseEvaluation)
    {
        CaseField.DestroyAllChildren();

        CaseDescription   caseDescription = caseEvaluation.RoleplayDescription.Case;
        ModuleCaseProfile profile         = ProfileContainer.GetCaseProfileOfModule(caseDescription.Module);

        int[][] characteristics = caseDescription.Characteristics;

        for (int i = 0; i < characteristics.Length; i++)
        {
            CaseElement       element           = profile.GetElement(i);
            VisualCaseElement visualCaseElement = Instantiate(ElementObject, CaseField);
            visualCaseElement.SetName(element.Name);
            int[] elementIndices = characteristics[i];

            for (int j = 0; j < elementIndices.Length; j++)
            {
                int    k = elementIndices[j];
                string characteristic = element.OptionPool[k];

                visualCaseElement.AddCharacteristic(characteristic);
            }
        }
    }
Example #2
0
 public RoleplayDescription(string id, Participant userA, Participant userB, CaseDescription caseDescription)
 {
     this.Id    = id;
     this.UserA = userA;
     this.UserB = userB;
     this.Case  = caseDescription;
 }
    public RoleplayDescription Generate(Participant participantA, Participant participantB, RoleplayModule module)
    {
        CaseDescription caseDescription = GenerateCase(module);

        RoleplayDescription roleplayDescription;

        string id = GetCaseId();

        int rnd = random.Next(0, 2);

        if (rnd % 2 == 0)
        {
            roleplayDescription = new RoleplayDescription(id, participantA, participantB, caseDescription);
        }
        else
        {
            roleplayDescription = new RoleplayDescription(id, participantB, participantA, caseDescription);
        }

        return(roleplayDescription);
    }
    private CaseDescription GenerateCase(RoleplayModule module)
    {
        ModuleCaseProfile profile = ProfileContainer.GetCaseProfileOfModule(module);

        int[][] elementData = new int[profile.Elements.Length][];

        for (int i = 0; i < profile.Elements.Length; i++)
        {
            CaseElement element = profile.Elements[i];

            int   count = Mathf.Min(element.OptionCount, element.OptionPool.Length);
            int[] data  = elementData[i] = new int[count];

            for (int j = 0; j < count; j++)
            {
                int k = random.Next(element.OptionPool.Length);

                for (int l = 0; l < j; l++)
                {
                    int m = data[l];

                    if (m == j)
                    {
                        j--;
                        break;
                    }
                }

                data[j] = k;
            }
        }

        CaseDescription caseDescription = new CaseDescription(elementData, module);

        return(caseDescription);
    }