Пример #1
0
    void Awake()
    {
        googleAnalytics = GameObject.Find("GAv3").GetComponent <GoogleAnalyticsV3>();

        CM  = GameObject.Find("Manager").GetComponent <CameraManager>();
        SAM = GameObject.Find("SharkModel").GetComponent <SharkAnimManager>();
        TAM = GameObject.Find("TurtleModel").GetComponent <TurtleAnimManager>();
        FM  = GameObject.Find("Manager").GetComponent <FactManager>();
        SMC = GameObject.Find("AnimalParent").GetComponent <SharkMovementController>();

        Screen_Main       = GameObject.Find("Panel 1");
        Screen_Experience = GameObject.Find("Panel 2");

        SharkModel  = GameObject.Find("SharkModel");
        TurtleModel = GameObject.Find("TurtleModel");

        TrackingHint      = GameObject.Find("TrackingHint");
        Button_Back       = GameObject.Find("Back_Btn");
        Button_FactFinder = GameObject.Find("FactStart_Btn");
        Title_Hotspot     = GameObject.Find("Title_Hotspot");
        Button_Menu       = GameObject.Find("Menu_Btn");
        Popup_Fact        = GameObject.Find("FactPanel");

        SharkHotspots  = GameObject.Find("SharkHotSpots");
        TurtleHotspots = GameObject.Find("TurtleHotSpots");

        animalName_Lbl = GameObject.Find("AnimalName_Lbl").GetComponent <UILabel>();

        screenTween1           = Screen_Main.GetComponent <Animation>();
        screenTween2           = Screen_Experience.GetComponent <Animation>();
        dropdownmenuTween      = GameObject.Find("Dropdown").GetComponent <Animation>();
        dropdownmenu_mainTween = GameObject.Find("Main_Dropdown").GetComponent <Animation>();
        factPanelTween         = Popup_Fact.GetComponent <Animation>();
        animalSwapTween        = GameObject.Find("CharacterSelect").GetComponent <Animation>();
    }
Пример #2
0
        public void startManualTest()
        {
            FactManager     factManager     = new FactManager();
            QuestionManager questionManager = new QuestionManager();

            questionManager.manualStart(factManager);
        }
        public QuestionDatabase manualStart(FactManager factManager)
        {
            string signal;
            LinkedListNode <Question> firstNode = questionDatabase.getQuestions().First;

            for (LinkedListNode <Question> question = firstNode; question != null; question = question.Next)
            {
                if (question.Value.getStatus())
                {
                    signal = question.Value.show();
                    while (signal == "back")
                    {
                        if (question != firstNode)
                        {
                            question = question.Previous;
                        }
                        signal = question.Value.show();
                    }
                    string currentQuestionTag = question.Value.getTag();
                    bool   continueSignal     = updateQuestionList(signal, currentQuestionTag, factManager);
                    if (!continueSignal)
                    {
                        break;
                    }
                }
            }
            answersAnalysis(factManager);
            return(questionDatabase);
        }
        private void answersAnalysis(FactManager factManager)
        {
            List <string> tags = new List <string>();

            for (LinkedListNode <Question> question = questionDatabase.getQuestions().First; question != null; question = question.Next)
            {
                Question node = question.Value;
                if (node.getAnswer())
                {
                    tags.Add(node.getTag());
                }
            }
            Dictionary <Fact, double> compareTags = factManager.getFactDatabase().Compare(tags);
            double max     = 0.0;
            Fact   maxFact = new Fact();

            foreach (var entry in compareTags)
            {
                if (entry.Value > max)
                {
                    max     = entry.Value;
                    maxFact = entry.Key;
                }
            }
            maxFact.show(max);
        }
Пример #5
0
    public override void OnHit(RaycastHit hit)
    {
        if (!this.isActiveAndEnabled)
        {
            return;
        }
        if (hit.transform.gameObject.layer == LayerMask.NameToLayer("Point"))
        {
            Fact tempFact = StageStatic.stage.factState[hit.transform.GetComponent <FactObject>().URI];

            //If first point was already selected AND second point != first point
            if (this.LineModeIsFirstPointSelected && this.LineModeFirstPointSelected.Id != tempFact.Id)
            {
                //Create LineFact
                FactManager.AddRayFact(this.LineModeFirstPointSelected.Id, tempFact.Id);

                this.ResetGadget();
            }
            else
            {
                //Activate LineDrawing for preview
                this.LineModeIsFirstPointSelected = true;
                this.LineModeFirstPointSelected   = tempFact;
                this.ActivateLineDrawing();
            }
        }

        //if we hit the top snap zone
        //TODO: check behaviour
        else if (hit.transform.gameObject.CompareTag("SnapZone"))
        {
            if (this.LineModeIsFirstPointSelected)
            {
                RaycastHit downHit;

                if (Physics.Raycast(hit.transform.gameObject.transform.position - Vector3.down * 2, Vector3.down, out downHit))
                {
                    //Create LineFact
                    var idA = downHit.transform.gameObject.GetComponent <FactObject>().URI;
                    var idB = this.LineModeFirstPointSelected.Id;
                    FactManager.AddAngleFact(idA, idB, FactManager.AddPointFact(hit).Id);

                    this.ResetGadget();
                }
            }
        }

        //If no Point was hit
        else
        {
            if (this.LineModeIsFirstPointSelected)
            {
                //Deactivate LineDrawing and first point selection
                this.ResetGadget();
            }

            //TODO: Hint that only a line can be drawn between already existing points
        }
    }
Пример #6
0
 internal Observer(Specification specification, Product initialAnchor, FactManager factManager, IObservation observation)
 {
     this.specification = specification;
     this.initialAnchor = initialAnchor;
     this.factManager   = factManager;
     this.observation   = observation;
     this.inverses      = specification.ComputeInverses();
 }
Пример #7
0
        /// <summary>
        /// Class constructor
        /// </summary>
        public StereotypesInterface()
        {
            InitializeComponent();
            DataContext = this;

            _factManager = FactManager.Instance;
            Shuffle(this._factManager.Facts.Stereotypes);
            SetCurrentFact(this._factManager);
        }
Пример #8
0
    public override void OnHit(RaycastHit hit)
    {
        if (!this.isActiveAndEnabled)
        {
            return;
        }
        if (hit.transform.gameObject.layer == LayerMask.NameToLayer("Point"))
        {
            PointFact tempFact = (PointFact)StageStatic.stage.factState[hit.transform.GetComponent <FactObject>().URI];

            //If two points were already selected and now the third point got selected
            if (this.angleModeIsFirstPointSelected && this.angleModeIsSecondPointSelected)
            {
                //Create AngleFact
                //Check if new Point is equal to one of the previous points -> if true -> cancel
                if (!(this.angleModeFirstPointSelected.Id == tempFact.Id || this.angleModeSecondPointSelected.Id == tempFact.Id))
                {
                    FactManager.AddAngleFact(((PointFact)this.angleModeFirstPointSelected).Id, ((PointFact)this.angleModeSecondPointSelected).Id, ((PointFact)tempFact).Id);
                }

                ResetGadget();
            }
            //If only one point was already selected
            else if (this.angleModeIsFirstPointSelected && !this.angleModeIsSecondPointSelected)
            {
                //Check if the 2 selected points are the same: If not
                if (this.angleModeFirstPointSelected.Id != tempFact.Id)
                {
                    this.angleModeIsSecondPointSelected = true;
                    this.angleModeSecondPointSelected   = tempFact;

                    ActivateCurveDrawing();
                }
                else
                {
                    this.angleModeFirstPointSelected   = null;
                    this.angleModeIsFirstPointSelected = false;
                }
            }
            //If no point was selected before
            else
            {
                //Save the first point selected
                this.angleModeIsFirstPointSelected = true;
                this.angleModeFirstPointSelected   = tempFact;
            }
        }
        //No point was hit
        else
        {
            ResetGadget();

            //TODO: Hint that only an angle can be created between 3 already existing points
        }
    }
Пример #9
0
    public override void OnHit(RaycastHit hit)
    {
        if (!this.isActiveAndEnabled)
        {
            return;
        }
        var pid = FactManager.AddPointFact(hit).Id;

        if (hit.transform.gameObject.layer == LayerMask.NameToLayer("Ray"))
        {
            FactManager.AddOnLineFact(pid, hit.transform.GetComponent <FactObject>().URI, true);
        }
    }
Пример #10
0
    protected void Awake()
    {
        if (FactManager == null)
        {
            FactManager = GameObject.FindObjectOfType <FactManager>();
        }

        if (Cursor == null)
        {
            Cursor = GameObject.FindObjectOfType <WorldCursor>();
        }

        CommunicationEvents.TriggerEvent.AddListener(OnHit);
    }
        private bool updateQuestionList(string signal, string tag, FactManager factManager)
        {
            if (signal == "y")
            {
                //выборка списка тегов из базы знаний
                List <string> resultTags = new List <string>();
                Dictionary <List <string>, Fact> facts = factManager.getFactDatabase().getFacts();
                int  count          = 0;
                bool continueSignal = true;
                foreach (KeyValuePair <List <string>, Fact> entry in facts)
                {
                    if (entry.Key.Contains(tag))
                    {
                        foreach (var element in entry.Key)
                        {
                            resultTags.Add(element);
                        }
                        count++;
                    }
                }

                if (count == 1)
                {
                    continueSignal = false;
                }

                LinkedListNode <Question> firstNode = questionDatabase.getQuestions().First;
                for (LinkedListNode <Question> question = firstNode; question != null; question = question.Next)
                {
                    string currentQuestionTag = question.Value.getTag();
                    //question.Value.getId() != id &&
                    if (!resultTags.Contains(currentQuestionTag))
                    {
                        //удаление узла question
                        question.Value.setStatus(false);

                        /*question.Previous.Next = question.Next;
                         * question.Next.Previous = question.Previous;
                         * question.Previous = null;
                         * question.Next = null;*/
                    }
                }
                return(continueSignal);
            }
            else
            {
                return(true);
            }
        }
Пример #12
0
        private static async Task AddFact(string factName, string source, int categoryId)
        {
            IFactManager     factManager     = new FactManager();
            ICategoryManager categoryManager = new CategoryManager();

            Fact fact = new Fact()
            {
                FactName     = factName,
                Created      = DateTime.Now,
                LastModified = DateTime.MinValue,
                Source       = source
            };

            await factManager.AddFact(fact, await categoryManager.GetCategory(categoryId));
        }
Пример #13
0
    public override void OnHit(RaycastHit hit)
    {
        if (!this.isActiveAndEnabled)
        {
            return;
        }

        if (hit.transform.gameObject.layer == LayerMask.NameToLayer("Point"))
        {
            PointFact tempFact = StageStatic.stage.factState[hit.transform.GetComponent <FactObject>().URI] as PointFact;

            //Raycast downwoard
            RaycastHit ground;
            if (Physics.Raycast(tempFact.Point, Vector3.down, out ground, Mathf.Infinity, this.LayerPendulumHits.value))
            {
                FactManager.AddPointFact(ground);
            }
        }
    }
Пример #14
0
    public override void OnHit(RaycastHit hit)
    {
        if (!this.isActiveAndEnabled ||
            !Physics.Raycast(Cursor.transform.position + Vector3.up * (float)Math3d.vectorPrecission,
                             Vector3.down, maxHeight + (float)Math3d.vectorPrecission, LayerMask.GetMask(new string[] { "Default", "Tree" })))
        {
            return;
        }

        UpdateLineDrawing();

        if (hit.transform.gameObject.layer == LayerMask.NameToLayer("Point"))
        {
            var pid2 = FactManager.AddPointFact(linePositions[1], Vector3.up).Id;
            FactManager.AddLineFact(hit.transform.gameObject.GetComponent <FactObject>().URI, pid2, true);
        }
        else
        {
            FactManager.AddPointFact(hit);
        }
    }
Пример #15
0
    private void readPushout(List <Scroll.ScrollFact> pushoutFacts)
    {
        FactManager factManager = cursor.GetComponent <FactManager>();

        if (pushoutFacts.Count == 0)
        {
            PushoutFactFailEvent.Invoke(null);
        }

        bool samestep = false;

        for (int i = 0; i < pushoutFacts.Count; i++, samestep = true)
        {
            Fact newFact = ParsingDictionary.parseFactDictionary[pushoutFacts[i].getType()].Invoke(pushoutFacts[i]);
            if (newFact != null)
            {
                PushoutFactEvent.Invoke(FactManager.AddFactIfNotFound(newFact, out bool exists, samestep));
            }
            else
            {
                Debug.Log("Parsing on pushout-fact returned null -> One of the dependent facts does not exist");
            }
        }
    }
Пример #16
0
    public override void OnHit(RaycastHit hit)
    {
        void CreateRayAndAngles(string pidIntersectionPoint, string pidLotPoint, bool samestep)
        {
            FactManager.AddRayFact(pidIntersectionPoint, pidLotPoint, samestep);

            //TODO: create at all? / for all points on basline?
            FactManager.AddAngleFact(
                this.LotModeLineSelected.Pid1 == pidIntersectionPoint ? this.LotModeLineSelected.Pid2 : this.LotModeLineSelected.Pid1,
                pidIntersectionPoint, pidLotPoint, true);
        }

        if (!this.isActiveAndEnabled)
        {
            return;
        }

        //If LotPoint is on baseLine
        if (this.LotModeIsPointSelected && (hit.transform.gameObject.layer == LayerMask.NameToLayer("Default") || hit.transform.gameObject.layer == LayerMask.NameToLayer("Tree")))
        {
            Vector3 LotPoint = Math3d.ProjectPointOnLine(hit.point, this.LotModeLineSelected.Dir, this.LotModeIntersectionPoint.Point);

            //TODO: which normal?
            CreateRayAndAngles(this.LotModeIntersectionPoint.Id, FactManager.AddPointFact(LotPoint, hit.normal).Id, true);
            this.ResetGadget();
        }

        //If baseline already selected and point selected
        else if (this.LotModeIsLineSelected && !this.LotModeIsPointSelected && hit.transform.gameObject.layer == LayerMask.NameToLayer("Point"))
        {
            PointFact tempFact = StageStatic.stage.factState[hit.transform.GetComponent <FactObject>().URI] as PointFact;

            Vector3 intersectionPoint = Math3d.ProjectPointOnLine(this.LotModeLinePointA.Point, this.LotModeLineSelected.Dir, tempFact.Point);

            if (intersectionPoint == tempFact.Point) // Vector3.operator== tests for almost Equal()
            {                                        //TempFact is on baseLine
                this.LotModeIsPointSelected   = true;
                this.LotModeIntersectionPoint = tempFact;
                return;
            }

            //TODO: test Facts existance
            //add Facts
            var intersectionId = FactManager.AddPointFact(intersectionPoint, this.LotModeLineHit.normal).Id;

            if (this.LotModeLineSelected is RayFact) //Add OnLineFact only on Ray not Line
            {
                FactManager.AddOnLineFact(intersectionId, this.LotModeLineSelected.Id, true);
            }

            CreateRayAndAngles(intersectionId, tempFact.Id, true);
            this.ResetGadget();
        }

        //If nothing yet selected
        else if (!this.LotModeIsLineSelected &&
                 (hit.transform.gameObject.layer == LayerMask.NameToLayer("Ray") ||
                  hit.transform.gameObject.layer == LayerMask.NameToLayer("Line")))
        {
            Fact tempFact = StageStatic.stage.factState[hit.transform.GetComponent <FactObject>().URI];

            //Activate LineDrawing for preview
            this.LotModeIsLineSelected = true;
            this.LotModeLineSelected   = tempFact as AbstractLineFact;
            this.LotModeLinePointA     = (PointFact)StageStatic.stage.factState[this.LotModeLineSelected.Pid1];
            this.LotModeLineHit        = hit;
            this.ActivateLineDrawing();
        }

        //unexpected usage
        else
        {
            if (this.LotModeIsLineSelected)
            {
                //Deactivate LineDrawing and first point selection
                this.ResetGadget();
            }
        }
    }
Пример #17
0
 public Jinaga(IStore store)
 {
     this.factManager = new FactManager(store);
 }
Пример #18
0
 /// <summary>
 /// Initialize current fact
 /// </summary>
 /// <param name="manager"></param>
 public void SetCurrentFact(FactManager manager)
 {
     this._fact = manager.Facts.Stereotypes.ElementAt(0);
 }