/* Temporarily removing realtime capability
         * private void ProcessPoint(Vector3 point)
         * {
         *  currPoint = point;
         *  int hits = Physics.OverlapSphereNonAlloc(point, radius, collisions, layerMask);
         *  bool hitParticle = false;
         *  for (int i = 0; i < hits; i++)
         *  {
         *      if (collisions[i].TryGetComponent(out HeatmapParticle particle))
         *      {
         *          hitParticle = true;
         *          particle.Height += incrementVal;
         *      }
         *      //yield return new WaitForEndOfFrame();
         *  }
         *
         *  if (!hitParticle)
         *  {
         *      HeatmapParticle particle = factory.Get(this);
         *      particle.transform.position = point;
         *      particles.Add(particle);
         *  }
         * }
         */



        public void CreateParticleWithHeight(SmallVector3 point, float height = 0.01f)
        {
            if (particles == null)
            {
                particles = new Dictionary <SmallVector3, HeatmapParticle>();
            }
            HeatmapParticle p;

            if (particles.TryGetValue(point, out p))
            {
                Debug.Log("particle already exists!");
            }
            else
            {
                p =
#if UNITY_EDITOR
                    Application.isPlaying ? factory.Get(this) : factory.GetInEditor();
#else
                    factory.Get(this);
#endif
                p.transform.position = point.GetVector3();
                p.Height             = height;
                particles.Add(point, p);
            }
        }
        public void SpawnAtPoint(SmallVector3 point)
        {
            int height = points.CurrDict[point].height;

            if (particles.TryGetValue(point, out HeatmapParticle p))
            {
                p.Height = height * incrementVal;
            }
            else
            {
                if (height == 1)
                {
                    CreateParticleWithHeight(point);
                }
                else
                {
                    CreateParticleWithHeight(point, height * incrementVal);
                }
            }

            //StartCoroutine(ProcessPoint(point));
#if UNITY_EDITOR
            if (debugText)
            {
                debugText.text = particles.Count.ToString();
            }
#endif
        }
Exemple #3
0
        public static ListContainer Load(DataReader reader)
        {
            Dictionary <SmallVector3, HeatmapInfo> dict = new Dictionary <SmallVector3, HeatmapInfo>();
            int pointCount = reader.ReadInt();

            dict.Clear();
            for (int j = 0; j < pointCount; j++)
            {
                SmallVector3 key   = SmallVector3.Load(reader);
                HeatmapInfo  value = HeatmapInfo.Load(reader);
                if (dict.ContainsKey(key))
                {
                    dict[key] = value;
                }
                else
                {
                    dict.Add(key, value);
                }
            }
            return(new ListContainer
            {
                dictionary = dict,
                listTime = reader.ReadDateTime()
            });
        }