Ejemplo n.º 1
0
    public override StudentAction GetNextStudentAction()
    {
        Debug.Log("GetNextStudentAction()");
        prev = curr;
        curr = next;
        XmlNode node = GetNextEvent();

        Debug.Log(node.OuterXml);
        if (node != null)
        {
            string selection     = node[StudentAction.SELECTION].InnerText;
            string action        = node[StudentAction.ACTION].InnerText;
            string input         = node[StudentAction.INPUT].InnerText;
            string levelName     = node[StudentAction.SELECTION].InnerText;
            string state         = node[StudentAction.STATE].InnerText;
            string time          = node[StudentAction.TIME].InnerText;
            string user          = node[StudentAction.USER_ID].InnerText;
            string attemptNum    = node[StudentAction.ATTEMPT_NUMBER].InnerText;
            string sessionID     = node[StudentAction.SESSION_ID].InnerText;
            string transactionID = node[StudentAction.TRANSACTION_ID].InnerText;
            next = new StudentAction(selection, action, input, state, time, user, levelName, attemptNum, sessionID, transactionID);
        }
        else
        {
            next = StudentAction.NullAction;
        }
        return(curr);
    }
Ejemplo n.º 2
0
    private IEnumerator JannikNeighbourActivity(StudentAction stu)
    {
        yield return(new WaitForSeconds(Random.Range(1.0f, 4.0f)));

        stu.LookAtSomeone(stu.chairPoint.gameObject.transform.GetComponentInChildren <StudyMaterialType>().Tablet.transform);
        yield return(new WaitForSeconds(3.0f));

        stu.studentAnimation.MB33_WorkOnSheets(true);
        yield return(new WaitForSeconds(4.0f));

        stu.studentAnimation.MB33_WorkOnSheets(false);

        //yield return new WaitForSeconds(Random.Range(1.0f, 4.0f));
        stu.LookAtSomeone(stu.chairPoint.gameObject.transform.GetComponentInChildren <StudyMaterialType>().Tablet.transform);
        yield return(new WaitForSeconds(3.0f));

        stu.studentAnimation.MB33_WorkOnSheets(true);
        yield return(new WaitForSeconds(4.0f));

        stu.studentAnimation.MB33_WorkOnSheets(false);

        //yield return new WaitForSeconds(Random.Range(1.0f, 4.0f));
        stu.LookAtSomeone(stu.chairPoint.gameObject.transform.GetComponentInChildren <StudyMaterialType>().Tablet.transform);
        yield return(new WaitForSeconds(3.0f));

        stu.studentAnimation.MB33_WorkOnSheets(true);
        yield return(new WaitForSeconds(4.0f));

        stu.studentAnimation.MB33_WorkOnSheets(false);
    }
Ejemplo n.º 3
0
 public override StudentAction GetNextStudentAction()
 {
     Debug.Log("GetNextStudentAction()");
     prev = curr;
     curr = next;
     XmlNode node = GetNextEvent();
     Debug.Log(node.OuterXml);
     if (node != null) {
         string selection = node[StudentAction.SELECTION].InnerText;
         string action = node[StudentAction.ACTION].InnerText;
         string input = node[StudentAction.INPUT].InnerText;
         string levelName = node[StudentAction.SELECTION].InnerText;
         string state = node[StudentAction.STATE].InnerText;
         string time = node[StudentAction.TIME].InnerText;
         string user = node[StudentAction.USER_ID].InnerText;
         string attemptNum = node[StudentAction.ATTEMPT_NUMBER].InnerText;
         string sessionID = node[StudentAction.SESSION_ID].InnerText;
         string transactionID = node[StudentAction.TRANSACTION_ID].InnerText;
         next = new StudentAction(selection, action, input, state, time, user, levelName, attemptNum, sessionID, transactionID);
     }
     else {
         next = StudentAction.NullAction;
     }
     return curr;
 }
Ejemplo n.º 4
0
 public ActionResult CreateStudent()
 {
     if ((string)Session["role"] == "Admin")
     {
         var         student     = UserAction.GetAll();
         List <User> lst_student = new List <User>();
         for (int i = 0; i < student.Count; i++)
         {
             if (student[i].role == "Student" && StudentAction.Find(student[i].id_number) == null)
             {
                 lst_student.Add(student[i]);
             }
         }
         ViewBag.Account     = lst_student;
         ViewBag.Nganh       = MajorAction.GetAll();
         ViewBag.ChuyenNganh = SpecializedAction.GetAll();
         ViewBag.Lop         = ClassAction.GetAll();
         ViewBag.SV          = StudentAction.ShowAll();
         return(View());
     }
     else
     {
         return(Redirect("~/Home/Index"));
     }
 }
Ejemplo n.º 5
0
 public ActionResult RegisterSubject()
 {
     //ViewBag.MH = SubjectAction.ShowAll();
     if ((string)Session["role"] == "Student")
     {
         var tmp = SubjectAction.ShowAll();
         List <Tuple <RegisterSubject, Student> >          subject = StudentAction.GetAllSubject();
         List <Tuple <Subject, YearTerm, Class, Teacher> > lst     = (List <Tuple <Subject, YearTerm, Class, Teacher> >)Session["student_subject"];
         if (lst != null)
         {
             for (int i = 0; i < lst.Count; i++)
             {
                 tmp.RemoveAll(a => a.Item1.id == lst[i].Item1.id);
             }
         }
         if (subject != null)
         {
             for (int i = 0; i < subject.Count; i++)
             {
                 tmp.RemoveAll(a => a.Item1.id == subject[i].Item1.id_subject);
             }
         }
         ViewBag.DK = lst;
         ViewBag.Mh = tmp;
         return(View());
     }
     else
     {
         return(Redirect("~/Home/Index"));
     }
 }
Ejemplo n.º 6
0
 public override StudentAction GetNextStudentAction()
 {
     prev = curr;
     curr = next;
     if (reader.Read())
     {
         //Debug.Log("Selection: " + reader["selection"]);
         next = new StudentAction(
             reader["selection"].ToString(),
             reader["action"].ToString(),
             reader["input"].ToString(),
             reader["state"].ToString(),
             reader["eventTime"].ToString(),
             reader["userID"].ToString(),
             reader["levelName"].ToString(),
             reader["attemptNumber"].ToString(),
             reader["sessionID"].ToString(),
             reader["transactionID"].ToString()
             );
     }
     else
     {
         next = StudentAction.NullAction;
     }
     return(curr);
 }
Ejemplo n.º 7
0
 public StudentActionInfo(StudentAction action)
 {
     Id          = action.Id;
     Description = action.Description;
     Penalty     = action.Penalty;
     Time        = action.Time;
 }
Ejemplo n.º 8
0
    IEnumerator SR4StudentWalkTowardsNewChair(StudentAction stu, int NewChairNumber)
    {
        yield return(new WaitForSeconds(UnityEngine.Random.Range(0.1f, 1.5f)));

        stu.FindMyChair("Chair", NewChairNumber);
        stu.GoToAndSitInChair();
    }
Ejemplo n.º 9
0
    IEnumerator StudentsRaiseHands(StudentAction stu)
    {
        yield return(new WaitForSeconds(Random.Range(0.1f, 2f)));

        stu.studentAnimation.RaiseHandAndKeep(true);
        stu.LookAtSomeone(GameObject.FindGameObjectWithTag("Player").transform);
    }
Ejemplo n.º 10
0
    private void InstantiateAction(StudentAction action)
    {
        if (action.Equals(StudentAction.NullAction))
        {
            return;
        }
        if (!action.HasObjectInput())
        {
            return;
        }

        //Debug.Log(action);

        XmlNodeList objects = action.InputXML.SelectNodes(Logger.OBJECT);

        if (objects.Count == 0)
        {
            return;
        }
        else
        {
            foreach (XmlNode node in objects)
            {
                GameObject gob = SpawnObject(node, action);
                if (gob != null)
                {
                    gob.GetComponent <ReplayBehavior>().ReplayTag = ReplayBehavior.RAETag.Action;
                    extender.SpecializeNewObject(gob, node, action);
                }
            }
        }
    }
Ejemplo n.º 11
0
 private void InstantiateState(StudentAction action)
 {
     if (action.Equals(StudentAction.NullAction))
     {
         return;
     }
     ClearState();
     ClearAction();
     if (action.StateXML != null)
     {
         XmlNodeList objects = action.StateXML.SelectNodes(Logger.OBJECT);
         foreach (XmlNode entry in objects)
         {
             if (entry[Logger.NAME].InnerText != action.Selection)
             {
                 GameObject gob = SpawnObject(entry, action);
                 if (gob != null)
                 {
                     gob.GetComponent <ReplayBehavior>().ReplayTag = ReplayBehavior.RAETag.State;
                     extender.SpecializeNewObject(gob, entry, action);
                 }
             }
         }
     }
 }
Ejemplo n.º 12
0
    IEnumerator SRTwoLoop(StudentAction stu)
    {
        yield return(new WaitForSeconds(UnityEngine.Random.Range(0.1f, 0.5f)));

        stu.studentAnimation.MB9_LookAround(true);
        stu.SetMyMood(MoodIndicator.Middle);
    }
Ejemplo n.º 13
0
    IEnumerator StudentsWithBlueBooksGetBored(StudentAction stu)
    {
        stu.studentAnimation.MB33_WorkOnSheets(false);
        stu.SetMyMood(MoodIndicator.Middle);
        yield return(new WaitForSeconds(UnityEngine.Random.Range(1f, 5f)));

        stu.studentAnimation.MB9_LookAround(true);
    }
Ejemplo n.º 14
0
 IEnumerator StudentsBackToSeat(StudentAction stu)
 {
     stu.gameObject.SetActive(false);
     stu.gameObject.transform.position = stu.chairPoint.position;
     stu.gameObject.SetActive(true);
     stu.GoToAndSitInChair();
     yield return(new WaitForSeconds(2f));
 }
Ejemplo n.º 15
0
    IEnumerator SR3MaximActivity(StudentAction stu)
    {
        stu.SetMyMood(MoodIndicator.Middle);
        yield return(new WaitForSeconds(3f));

        stu.studentAnimation.RaiseHand(true);
        //stu.LookAtSomeone(GameObject.FindGameObjectWithTag("Player").transform);
    }
Ejemplo n.º 16
0
    IEnumerator SRWorkOnSheetsWithRandomDelayAfterWorkOnSheets(StudentAction stu)
    {
        stu.studentAnimation.VI11_TalkToFriendsLeftAndRight();
        yield return(new WaitForSeconds(Random.Range(0.1f, 3f)));

        stu.studentAnimation.VI11_TalkToFriendsStop();
        stu.studentAnimation.MB33_WorkOnSheets(true);
    }
Ejemplo n.º 17
0
    IEnumerator SR1Activity(StudentAction stu)
    {
        yield return(new WaitForSeconds(UnityEngine.Random.Range(0.1f, 2.5f)));

        stu.studentAnimation.MB33_WorkOnSheets(false);
        stu.studentAnimation.RaiseHand(true);
        stu.LookAtSomeone(GameObject.FindGameObjectWithTag("Player").transform);
    }
Ejemplo n.º 18
0
 private void Start()
 {
     Halo.enabled              = false;
     gamePlayManager           = FindObjectOfType <GamePlayManager>();
     IKControlScript           = GetComponentInParent <IKControl>();
     studentAction             = GetComponentInParent <StudentAction>();
     playerCamera              = Camera.main;
     updateStudentSelectedData = false;
 }
Ejemplo n.º 19
0
    IEnumerator TeleportStudentAndBackToSeat(StudentAction stu)
    {
        stu.gameObject.SetActive(false);
        stu.gameObject.transform.position = classEntryPoint.position;
        yield return(new WaitForSeconds(UnityEngine.Random.Range(0.1f, 2.5f)));

        stu.gameObject.SetActive(true);
        stu.GoToAndSitInChair();
        yield return(new WaitForSeconds(2f));
    }
Ejemplo n.º 20
0
 private void Awake()
 {
     studentAction = GetComponentInParent <StudentAction>();
     if (studentAction)
     {
         //gamePlayManager.studentsActions.Add(this);
         studentAction.MyMoodChange += SetMoodIndicator;
         studentAction.ShowMyMood   += SetMoodIndicatorVisible;
     }
 }
Ejemplo n.º 21
0
    IEnumerator StudentWriteOnSheet(StudentAction stu)
    {
        yield return(new WaitForSeconds(UnityEngine.Random.Range(0.1f, 1f)));

        stu.studentAnimation.ResetAllAnim();
        stu.studentAnimation.MB33_WorkOnSheets(true);
        yield return(new WaitForSeconds(3.0f));

        stu.studentAnimation.MB33_WorkOnSheets(true);
    }
Ejemplo n.º 22
0
    IEnumerator SRLoop1(StudentAction stu)
    {
        //yield return new WaitForSeconds(Random.Range(0.1f, 1.5f));
        stu.studentAnimation.MB33_WorkOnSheets(true);
        yield return(new WaitForSeconds(5f));

        stu.studentAnimation.MB33_WorkOnSheets(true);
        yield return(new WaitForSeconds(5));

        stu.studentAnimation.MB33_WorkOnSheets(true);
    }
Ejemplo n.º 23
0
    private IEnumerator JannikActivity(StudentAction stu)
    {
        yield return(null);

        stu.SetMyMood(MoodIndicator.Bad);
        stu.studentAnimation.MB9_LookAround(true);
        if (stu.myNeighbourStudent != null)
        {
            stu.myNeighbourStudent.LookAtSomeone(stu.chairPoint.gameObject.transform.GetComponentInChildren <StudyMaterialType>().Tablet.transform);
        }
    }
Ejemplo n.º 24
0
 public bool IsSameAttempt(StudentAction other)
 {
     if (this == NullAction || other == NullAction)
     {
         return(this == other);
     }
     return(this.User == other.User &&
            this.SessionID == other.SessionID &&
            this.LevelName == other.LevelName &&
            this.Attempt == other.Attempt);
 }
Ejemplo n.º 25
0
 IEnumerator StudentsBackToSeat(StudentAction stu)
 {
     //stu.InitiateGoToSpot(stu.chairPoint,5f);
     //yield return new WaitForSeconds(5f);
     //stu.studentNavMesh.ResetNavigationSpeed();
     stu.gameObject.SetActive(false);
     stu.gameObject.transform.position = stu.chairPoint.position;
     stu.gameObject.SetActive(true);
     stu.GoToAndSitInChair();
     yield return(new WaitForSeconds(2f));
 }
Ejemplo n.º 26
0
    // kidMaxim.GetComponent<StudentAction>().chairPoint.gameObject.transform.GetComponentInChildren<StudyMaterialType>().Tablet.transform

    IEnumerator StudentsDropPencils(StudentAction stu, int i)
    {
        //stu.GetComponent<StudentAction>().chairPoint.gameObject.transform.GetComponentInChildren<StudyMaterialType>().Pencil.GetComponent<Animator>().SetBool("isThrow", true);
        //pencilAnim.SetBool("isThrow", true);
        //studentPencil[i].GetComponent<Animator>().SetBool("isThrow", true); // add student throw animation
        studentPencil[i].GetComponent <Rigidbody>().AddForce(Vector3.forward *  -300f);
        yield return(new WaitForSeconds(UnityEngine.Random.Range(0.1f, 1f)));

        stu.studentAnimation.MB9_LookAround(true);
        // start looking around animation
        yield return(null);
    }
Ejemplo n.º 27
0
    IEnumerator WaitForStop(StudentAction action)
    {
        List <GameObject> state = new List <GameObject>(ReplayBehavior.GetGameObjectsWithRAETag(ReplayBehavior.RAETag.State));

        state.AddRange(ReplayBehavior.GetGameObjectsWithRAETag(ReplayBehavior.RAETag.Action));
        Rigidbody rigidbody;
        float     callTime = Time.time;

        switch (stopCondition)
        {
        case StoppingCondition.Instant:
            break;

        case StoppingCondition.WaitForStop:
            bool allSleeping = false;
            while (!allSleeping)
            {
                allSleeping = true;
                if (Time.time - callTime > timeOut)
                {
                    break;
                }

                foreach (GameObject go in state)
                {
                    rigidbody = go.GetComponent <Rigidbody>();
                    if (go != null && rigidbody != null && rigidbody.IsSleeping())
                    {
                        allSleeping = false;
                        yield return(null);

                        break;
                    }
                }
            }
            break;

        case StoppingCondition.Time:
            while (Time.time - callTime < timeOut)
            {
                yield return(null);
            }
            break;

        case StoppingCondition.Custom:
            yield return(extender.StoppingCoroutine());

            break;
        }
        Stop(action);
    }
Ejemplo n.º 28
0
    IEnumerator SNStudentsLooksOutsideAndAroundWithDelay(StudentAction stu, float delay)
    {
        yield return(new WaitForSeconds(Random.Range(0.1f, 2f)));

        stu.studentAnimation.LookAround(true);
        yield return(new WaitForSeconds(2f));

        stu.studentAnimation.LookAround(false);
        stu.LookAtSomeone(stu.chairPoint.gameObject.GetComponent <ChairDetails>().GetAWindowToLookAt());
        yield return(new WaitForSeconds(2f));

        stu.StopLookAtSomeone();
        stu.studentAnimation.LookAround(true);
    }
Ejemplo n.º 29
0
 public ActionResult CreateTranscript()
 {
     if ((string)Session["role"] == "Admin")
     {
         ViewBag.SV   = StudentAction.GetAll();
         ViewBag.Mh   = SubjectAction.GetAll();
         ViewBag.Mark = RegSectorSubjectAction.ShowAll();
         return(View());
     }
     else
     {
         return(Redirect("~/Home/Index"));
     }
 }
Ejemplo n.º 30
0
    IEnumerator SRWorkOnSheetsWithRandomDelay(StudentAction stu)
    {
        yield return(new WaitForSeconds(Random.Range(0.1f, 1.5f)));

        stu.studentAnimation.MB33_WorkOnSheets(true);
        yield return(new WaitForSeconds(Random.Range(2f, 3f)));

        stu.studentAnimation.MB33_WorkOnSheets(false);
        stu.LookAtSomeone(stu.chairPoint.gameObject.GetComponent <ChairDetails>().GetAWindowToLookAt());
        yield return(new WaitForSeconds(2f));

        stu.StopLookAtSomeone();
        stu.studentAnimation.MB33_WorkOnSheets(true);
    }
Ejemplo n.º 31
0
    IEnumerator SR3StudentWalkTowardsFrontDesk(StudentAction stu, int val)
    {
        yield return(new WaitForSeconds(UnityEngine.Random.Range(0.1f, 1.5f)));

        stu.studentAnimation.ResetAllAnim();
        stu.InitiateGoToSpot(TeacherDesk.transform);
        yield return(new WaitUntil((() => stu.reachedSpot)));

        stu.studentAnimation.TakeItem(true);
        yield return(new WaitForSeconds(1f));

        if (val == 1)
        {
            stu.rightHandStudyMaterials.YellowPaper.SetActive(true);
        }
        else
        {
            stu.rightHandStudyMaterials.BluePaper.SetActive(true);
        }
        stu.studentAnimation.TakeItem(false);



        stu.GoToAndSitInChair();
        yield return(new WaitForSeconds(1f));

        yield return(new WaitUntil((() => stu.reachedSpot)));

        if (val == 1) // book yellow
        {
            stu.chairPoint.gameObject.transform.GetComponentInChildren <StudyMaterialType>().YellowPaper.SetActive(true);
            stu.rightHandStudyMaterials.YellowPaper.SetActive(false);
        }
        else
        {
            stu.chairPoint.gameObject.transform.GetComponentInChildren <StudyMaterialType>().BluePaper.SetActive(true);
            stu.rightHandStudyMaterials.BluePaper.SetActive(false);
        }
        yield return(new WaitForSeconds(4f));

        //stu.LookAtSomeone(stu.rightHandStudyMaterials.YellowPaper.transform);
        //stu.myNeighbourStudent.LookAtSomeone(stu.rightHandStudyMaterials.YellowPaper.transform);
        if (stu != KidJannik || stu != KidJannik.myNeighbourStudent)
        {
            stu.studentAnimation.MB33_WorkOnSheets(true);
            stu.myNeighbourStudent.studentAnimation.MB33_WorkOnSheets(true);
        }
        yield return(new WaitForSeconds(4f));
    }
    private GameObject SpawnObject(XmlNode node, StudentAction action)
    {
        string key = extender.LookupPrefab(node, action);

        if (string.IsNullOrEmpty(key)) {
            if (node[Logger.PREFAB] == null) {
                Debug.LogWarning("XmlNode contains no <Prefab> element, attempting to use the <Name> element instead.");
                if (node[Logger.NAME] == null) {
                    Debug.LogWarning("XmlNode contains no <Name> element. Giving up. Consider writing an extension to the LookupPrefab() "+
                    "method in the ReplayExtender class if your log files do not conform to the standard format.\nNode:" + node.OuterXml);
                    return null;
                }
                key = node[Logger.NAME].InnerText;
            }
            else {
                key = node[Logger.PREFAB].InnerText;
            }
        }

        GameObject prefab = dictionary.GetPrefab(key);

        if (prefab == null) {
            Debug.LogWarning("No Prefab found in dictionary for name:" + key + ", did you forget to add it, or spell the (case-sensative) key wrong? Giving up.");
            return null;
        }

        GameObject gob = null;

        float posX = float.Parse(node[Logger.TRANSFORM][Logger.POSITION]["X"].InnerText);
        float posY = float.Parse(node[Logger.TRANSFORM][Logger.POSITION]["Y"].InnerText);
        Vector3 pos = new Vector3(posX, posY, 0f);

        float rotZ = float.Parse(node[Logger.TRANSFORM][Logger.ROTATION].InnerText);
        Quaternion rot = Quaternion.Euler(0f, 0f, rotZ);

        gob = GameObject.Instantiate(prefab, pos, rot) as GameObject;

        gob.name = node[Logger.NAME].InnerText;
        ReplayBehavior rb = gob.AddComponent<ReplayBehavior>();

        if (node[Logger.PREFAB] != null)
            rb.PrefabName = node[Logger.PREFAB].InnerText;
        else
            rb.PrefabName = ReplayBehavior.NO_PREFAB_TAG;

        if (node[Logger.UNITY_TAG] != null)
            rb.UnityTag = node[Logger.UNITY_TAG].InnerText;
        else
            rb.UnityTag = ReplayBehavior.NO_UNITY_TAG;

        if (node[Logger.EXTRA_TAGS] != null) {
            List<string> newTags = new List<string>();
            foreach(XmlNode subNode in node[Logger.EXTRA_TAGS]) {
                if (subNode[Logger.TAG] != null) {
                    newTags.Add(subNode[Logger.TAG].InnerText);
                }
            }
            rb.AddTags(newTags);
        }

        return gob;
    }
 private void InstantiateState(StudentAction action)
 {
     if (action.Equals(StudentAction.NullAction))
         return;
     ClearState();
     ClearAction();
     if (action.StateXML != null) {
         XmlNodeList objects = action.StateXML.SelectNodes(Logger.OBJECT);
         foreach (XmlNode entry in objects) {
             if (entry[Logger.NAME].InnerText != action.Selection) {
                 GameObject gob = SpawnObject(entry, action);
                 if (gob != null) {
                     gob.GetComponent<ReplayBehavior>().ReplayTag = ReplayBehavior.RAETag.State;
                     extender.SpecializeNewObject(gob, entry, action);
                 }
             }
         }
     }
 }
 private void InstantiateStartState(StudentAction startState)
 {
     if (startState.Equals(StudentAction.NullAction) ||  startState.Action != Logger.START_STATE)
         return;
     ClearState();
     ClearAction();
     ClearStartState();
     if (startState.StateXML != null) {
         XmlNodeList objects = startState.StateXML.SelectNodes(Logger.OBJECT);
         foreach (XmlNode entry in objects) {
             GameObject gob = SpawnObject(entry, startState);
             if (gob != null) {
                 gob.GetComponent<ReplayBehavior>().ReplayTag = ReplayBehavior.RAETag.StartState;
                 extender.SpecializeNewObject(gob, entry, startState);
             }
         }
     }
 }
    private void InstantiateAction(StudentAction action)
    {
        if (action.Equals(StudentAction.NullAction))
            return;
        if (!action.HasObjectInput())
            return;

        //Debug.Log(action);

        XmlNodeList objects = action.InputXML.SelectNodes(Logger.OBJECT);
        if (objects.Count == 0) {
            return;
        }
        else foreach (XmlNode node in objects) {
            GameObject gob = SpawnObject(node, action);
            if (gob != null) {
                gob.GetComponent<ReplayBehavior>().ReplayTag = ReplayBehavior.RAETag.Action;
                extender.SpecializeNewObject(gob, node, action);
            }
        }
    }
 public void RunState(StudentAction action)
 {
     //Debug.Log(action);
     Time.timeScale = 1.0f;
     done = false;
     calculator.ResetScores();
     extender.OnActionPre(action);
     ClearState();
     ClearAction();
     InstantiateState(action);
     if (addActions)
         InstantiateAction(action);
     extender.OnActionPost(action);
     Time.timeScale = timeAcceleraton;
     StartCoroutine(WaitForStop(action));
 }
 public virtual void OnStop(StudentAction action)
 {
 }
Ejemplo n.º 38
0
 public bool IsSameAttempt(StudentAction other)
 {
     if (this == NullAction || other == NullAction)
         return this == other;
     return this.User == other.User
         && this.SessionID == other.SessionID
         && this.LevelName == other.LevelName
         && this.Attempt == other.Attempt;
 }
 public virtual void OnActionPre(StudentAction action)
 {
 }
 public virtual void OnNewLevel(StudentAction startState)
 {
 }
 public virtual string LookupPrefab(XmlNode objectNode, StudentAction action)
 {
     return null;
 }
 /// <summary>
 /// This method is used to do any particular specialization that may be necessary for your game.
 /// It will be called after the Prefab of the GameObject is instantiated. The method should 
 /// return the GameObject post-specialization. It is guaranteed that this method will never be 
 /// passed a <code>null</code> GameObject.
 /// </summary>
 /// <param name="gob">The instantiated GameObject as read from the log file.</param>
 /// <param name="node">The node from the log file that describes the GameObject.</param>
 /// <param name="action">The StudentAction that contains the current action and state information.</param>
 /// <returns></returns>
 public virtual GameObject SpecializeNewObject(GameObject gob, XmlNode node, StudentAction action)
 {
     return gob;
 }
 public virtual bool SkipAction(StudentAction action)
 {
     if (action != null && action.Action != null) {
         if (seeActionTypes.Contains(action.Action)) {
             int holder = ((int)seeActionTypes[action.Action]);
             holder += 1;
             seeActionTypes[action.Action] = holder;
         }
         else {
             seeActionTypes.Add(action.Action, 1);
         }
     }
     return skipActionTypes.Contains(action.Action);
 }
 private void Stop(StudentAction action)
 {
     Time.timeScale = 0f;
     extender.OnStop(action);
     //calculate
     calculator.CalculateScores(action);
     //screenshot
     if (takeScreenShot) {
         writer.CaptureScreenShotPNG(calculator.ScreenShotName);
     }
     //record
     writer.Write(calculator.CurrentLine);
     done = true;
 }
Ejemplo n.º 45
0
 public override StudentAction GetNextStudentAction()
 {
     prev = curr;
     curr = next;
     if (reader.Read()) {
         //Debug.Log("Selection: " + reader["selection"]);
         next = new StudentAction(
             reader["selection"].ToString(),
             reader["action"].ToString(),
             reader["input"].ToString(),
             reader["state"].ToString(),
             reader["eventTime"].ToString(),
             reader["userID"].ToString(),
             reader["levelName"].ToString(),
             reader["attemptNumber"].ToString(),
             reader["sessionID"].ToString(),
             reader["transactionID"].ToString()
             );
     }
     else {
         next = StudentAction.NullAction;
     }
     return curr;
 }
    IEnumerator WaitForStop(StudentAction action)
    {
        List<GameObject> state = new List<GameObject>(ReplayBehavior.GetGameObjectsWithRAETag(ReplayBehavior.RAETag.State));
        state.AddRange(ReplayBehavior.GetGameObjectsWithRAETag(ReplayBehavior.RAETag.Action));
        Rigidbody rigidbody;
        float callTime = Time.time;
        switch (stopCondition) {
            case StoppingCondition.Instant:
                break;
            case StoppingCondition.WaitForStop:
                bool allSleeping = false;
                while (!allSleeping) {
                    allSleeping = true;
                    if (Time.time - callTime > timeOut) {
                        break;
                    }

                    foreach (GameObject go in state) {
                        rigidbody = go.GetComponent<Rigidbody>();
                        if (go != null && rigidbody != null && rigidbody.IsSleeping()) {
                            allSleeping = false;
                            yield return null;
                            break;
                        }
                    }
                }
                break;
            case StoppingCondition.Time :
                while (Time.time - callTime < timeOut) {
                    yield return null;
                }
                break;
            case StoppingCondition.Custom :
                yield return extender.StoppingCoroutine();
                break;

        }
        Stop(action);
    }
Ejemplo n.º 47
0
 public abstract void CalculateScores(StudentAction action);