Beispiel #1
0
    public void ParseJsonTestSimplePasses()
    {
        Debug.Log("Current Directory: " + Application.dataPath);

        string file = Path.Combine(Application.dataPath, "Crawler/data.json");

        Assert.IsTrue(File.Exists(file));
        var companies = CompanyStore.ParseFromFile(file);

        Assert.IsTrue(companies.Count == 22);

        Assert.IsTrue(companies.First().EmployeeCount == 500);
    }
Beispiel #2
0
        void Start()
        {
            Companies = CompanyStore.ParseFromFile();

            _initialPositionMap = new Dictionary <string, Transform>(Companies.Count);
            ObjectMap           = new Dictionary <string, GameObject>(Companies.Count);

            foreach (var company in Companies)
            {
                const float y = 1.62f;

                var t = new Vector3(
                    Random.Range(0, 1f),
                    Random.Range(0, 1f),
                    Random.Range(0, 1f)
                    );

                var star = Instantiate(StarPrefab);
                star.transform.position = t;

                _initialPositionMap.Add(company.Id, star.transform);
                ObjectMap.Add(company.Id, star);
            }

            foreach (var o in ObjectMap)
            {
                var starController = (StarController)o.Value.GetComponent <StarController>();
                Debug.Assert(starController != null);
                starController.company = Companies
                                         .Single(p => p.Id == o.Key);

                var relatedSpheres = Companies
                                     .Single(p => p.Id == o.Key)
                                     .Similarities;

                Debug.Log(string.Format("{0} has {1} similiar companies", o.Key, relatedSpheres.Count));

                var relatedSpherePositions = relatedSpheres
                                             .Select(p => _initialPositionMap[p.Key]);

                starController.relatedSpheres = relatedSpherePositions.ToArray();
            }
        }