Exemple #1
0
    public bool CheckSolved()
    {
        double time_s = Time.timeSinceLevelLoadAsDouble;

        bool solved =
            factState.DynamiclySolved(solution, out _, out List <List <string> > hits);

        if (solved)
        {
            foreach (var hitlist in hits)
            {
                foreach (var hit in hitlist)
                {
                    AnimateExistingFactEvent.Invoke(factState[hit]);
                }
            }
        }

        if (solved && player_record.seconds > 0)
        {
            player_record.solved = true;
            push_record(time_s);
            store(true); // reset player_record
            player_record.solved = false;
        }

        return(solved);
    }
Exemple #2
0
    public void animateHint(GameObject scrollParameter, string scrollParameterUri)
    {
        Scroll.ScrollAssignment suitableCompletion = LatestCompletions.Find(x => x.fact.uri.Equals(scrollParameterUri));
        Fact fact;

        if (suitableCompletion != null)
        {
            if (StageStatic.stage.factState.ContainsKey(suitableCompletion.assignment.uri))
            {
                fact = StageStatic.stage.factState[suitableCompletion.assignment.uri];
                //Animate ScrollParameter
                scrollParameter.GetComponentInChildren <ImageHintAnimation>().AnimationTrigger();
                //Animate Fact in FactPanel
                AnimateExistingFactEvent.Invoke(fact);
                //Animate factRepresentation in game, if fact has a Representation (e.g. OnLineFact has no Representation)
                if (fact.Representation != null)
                {
                    fact.Representation.GetComponentInChildren <MeshRendererHintAnimation>().AnimationTrigger();
                }
            }
        }
        else if (LatestRenderedHints.Exists(x => x.Id.Equals(scrollParameterUri)))
        {
            fact = LatestRenderedHints.Find(x => x.Id.Equals(scrollParameterUri));
            var factId = fact.Id;

            //If there is an equal existing fact -> Animate that fact AND ScrollParameter
            if (StageStatic.stage.factState.ContainsKey(factId))
            {
                Fact existingFact = StageStatic.stage.factState[factId];

                //Animate ScrollParameter
                scrollParameter.GetComponentInChildren <ImageHintAnimation>().AnimationTrigger();
                //Animate Fact in FactPanel
                AnimateExistingFactEvent.Invoke(existingFact);
                //Animate factRepresentation in game if Fact has a Representation (e.g. OnLineFact has no Representation)
                if (existingFact.Representation != null)
                {
                    existingFact.Representation.GetComponentInChildren <MeshRendererHintAnimation>().AnimationTrigger();
                }
            }
            //If not -> Generate a Fact-Representation with such dependent facts
            else
            {
                //Animate ScrollParameter
                scrollParameter.GetComponentInChildren <ImageHintAnimation>().AnimationTrigger();
                //Generate new FactRepresentation and animate it
                AnimateNonExistingFactEvent.Invoke(fact);
            }
        }
    }
Exemple #3
0
    //Start is called before the first frame update
    void Start()
    {
        prefabDictionary = new Dictionary <Type, GameObject>()
        {
            { typeof(PointFact), prefab_Point },
            { typeof(LineFact), prefab_Distance },
            { typeof(RayFact), prefab_Line },
            { typeof(AngleFact), prefab_Angle },
            { typeof(OnLineFact), prefab_OnLine }
        };

        var rect = GetComponent <RectTransform>();

        x_Start          = (int)(rect.rect.x + X_Pacece_Between_Items * .5f);
        y_Start          = (int)(-rect.rect.y - y_Pacece_Between_Items * .5f);//);
        number_of_Column = Mathf.Max(1, (int)(rect.rect.width / prefab_Point.GetComponent <RectTransform>().rect.width) - 1);

        AddFactEvent.AddListener(AddFact);
        RemoveFactEvent.AddListener(RemoveFact);
        AnimateExistingFactEvent.AddListener(AnimateFact);
    }