Skip to content
Snippets Groups Projects
Select Git revision
  • 8cd4b853d474b2e72023a4c39b13532edda8144c
  • master default
  • JS-based-scroll-rendering
  • Paul_Marius_Level
  • Paul_Marius_2
  • Paul_Marius
  • Andi_Mark
  • be-UnityWebView
  • gitignoreFrameitServer
  • ZimmerBSc
  • Bugfix_StageLoading
  • stages
  • MAZIFAU_Experimental
  • tsc/coneworld
  • tsc/fact-interaction
  • marcel
  • MaZiFAU_TopSort
  • mergeHelper
  • zwischenSpeichern
  • tempAndrToMaster
  • SebBranch
  • 3.0
  • v2.1
  • v2.0
  • v1.0
25 results

Pythagoras-form.png.meta

Blame
  • FunctionFact.cs 9.92 KiB
    using System;
    using System.Collections.Generic;
    using UnityEngine;
    using Newtonsoft.Json;
    using static SOMDocManager;
    using System.Linq.Expressions;
    using System.Linq;
    using Characters.FirstPerson;
    
    public class FunctionCallFact : FactWrappedCRTP<FunctionCallFact>
    {
        public string func_id;
    
        public string arg_func_id;
    
        public (float t_0, float t_n) Domain;
    
        [JsonIgnore]
        public FunctionFact Function_in => (FunctionFact)FactOrganizer.AllFacts[func_id];
        [JsonIgnore]
        public FunctionFact Function_args => (FunctionFact)FactOrganizer.AllFacts[arg_func_id];
    
    
        public FunctionCallFact() : base() { }
    
        public FunctionCallFact(string func_id, string arg_func_id, (float t_0, float t_n) Domain, FactOrganizer organizer) : base(organizer)
        {
            this.func_id = func_id;
            this.arg_func_id = arg_func_id;
            this.Domain = Domain;
    
            _URI = func_id.ToString() + arg_func_id.ToString() + Domain.ToString();
        }
    
        public object[] Call(float t)
        {
            if (t < Domain.t_0 || t > Domain.t_n)
                return null;
    
            return Function_in.Function(Function_args.Function(new object[] { t }));
        }
    
        public override bool HasDependentFacts 
            => true;
    
        protected override string[] GetGetDependentFactIds()
            => new[] { func_id, arg_func_id };
    
        public override GameObject instantiateDisplay(GameObject prefab, Transform transform)
        {
            var obj = GameObject.Instantiate(prefab, Vector3.zero, Quaternion.identity, transform);
            //obj.transform.GetChild(0).gameObject.GetComponent<TextMeshProUGUI>().text = this.Label;
            //obj.GetComponent<FactWrapper>().fact = this;
            return obj;
        }
    
        protected override bool EquivalentWrapped(FunctionCallFact f1, FunctionCallFact f2)
            => f1.Domain.t_0.IsApproximatelyEqual(f2.Domain.t_0)
            && f1.Domain.t_n.IsApproximatelyEqual(f2.Domain.t_n)
            && (DependentFactsEquivalent(f1, f2)
                || (f1.Function_in.Equivalent(f2.Function_in)
                    && f1.Function_args.Equivalent(f2.Function_args)
            ));
    
        protected override MMTDeclaration MakeMMTDeclaration()
        {
            throw new NotImplementedException();
        }
    
        protected override void RecalculateTransform()