示例#1
0
文件: Stage.cs 项目: SESch93/UFrameIT
    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);
    }
示例#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);
            }
        }
    }