Beispiel #1
0
        // Before the script starts
        private void Start()
        {
            mapController = UIManager.GetScriptComponentByName <MapController>(MapControllerGameObjectName);
            if (mapController == null)
            {
                logger.Warn("No map controller found. Given name: " + MapControllerGameObjectName);
            }

            uiManager = UIManager.GetScriptComponentByName <UIManager>(UIManagerGameObjectName);
            if (uiManager == null)
            {
                logger.Warn("No UIManager found. Given name: " + UIManagerGameObjectName);
            }

            exampleInput = UIManager.GetScriptComponentByName <ExampleInput>(ExampleInputGameObjectName);
            if (exampleInput == null)
            {
                logger.Warn("No example input found. Given name: " + ExampleInputGameObjectName);
            }

            controller = UIManager.GetScriptComponentByName <Controller>(ControllerGameObjectName);
            if (controller == null)
            {
                logger.Warn("No controller found. Given name: " + ControllerGameObjectName);
            }
        }
        public void Example_1()
        {
            var ai = new AllergenIdentifier
            {
                Sets = ExampleInput.Select(x => new Set(x)).ToList()
            };

            ai.Analyze();

            Assert.Equal(4, ai.AllergenFreeIngredients.Count);
            Assert.Equal(5, ai.CountAllergenFreeIngredientsOccurrences());
        }
        private void SetupVehicleBehaviour(GameObject obj, Transform parent)
        {
            UpdateTransform(obj.transform, parent, behaviourOffset, defaultRotation);

            VehicleBehaviour vb = obj.AddComponent <VehicleBehaviour>();

            if (addEffectsComponent == true)
            {
                obj.AddComponent <VehicleEffects>();
            }

            if (addExampleInput == true)
            {
                ExampleInput exInput = obj.AddComponent <ExampleInput>();
                exInput.VehicleBehaviour = obj.GetComponent <VehicleBehaviour>();
            }
        }
        public void Example_2()
        {
            var ai = new AllergenIdentifier
            {
                Sets = ExampleInput.Select(x => new Set(x)).ToList()
            };

            ai.Analyze();

            var dangerousIngredients = ai.Sets
                                       .SelectMany(x => x.DangerousIngredients)
                                       .Distinct()
                                       .OrderBy(x => x.Value)
                                       .Aggregate("", (c, n) => $"{c},{n.Key}")[1..];

            Assert.Equal("mxmxvkd,sqjhc,fvjkl", dangerousIngredients);
        }
Beispiel #5
0
        private void AddQbEDisplay()
        {
            if (qbe != null)
            {
                RemoveQbE();
            }

            qbe = Instantiate(QbEDisplayPrefab);
            AttachToScroll(qbe);
            QbEDisplay disp = qbe.GetComponent <QbEDisplay>();

            if (disp != null)
            {
                disp.builder       = this;
                disp.image.texture = ExampleInput.FromBase64DataUrl(imageDataUrl);
                // needs to respect the aspect ratio!
            }
        }
 protected override void Start()
 {
     base.Start ();
     playerInput = (ExampleInput)GetComponent (typeof(ExampleInput));
 }