Exemple #1
0
        void Update()
        {
            if (revealFOW)
            {
                if (NJGMap.instance == null || miniMap == null)
                {
                    return;
                }

                if (mRevealer == null)
                {
                    mRevealer = NJGFOW.CreateRevealer();
                }

                if (isActive)
                {
                    mRevealer.pos            = miniMap.WorldToMap(transform.position, false);
                    mRevealer.revealDistance = revealDistance > 0 ? revealDistance : NJGMap.instance.fow.revealDistance;
                    mRevealer.isActive       = true;
                }
                else
                {
                    mRevealer.isActive = false;
                }
            }

            /*if (transform.hasChanged)
             * {
             *  if (worldMap != null) worldMap.UpdateItem(this);
             *  if (miniMap != null) miniMap.UpdateItem(this);
             *  transform.hasChanged = false;
             * }*/
        }
Exemple #2
0
    void Update()
    {
        if (revealFOW)
        {
            if (NJGMapBase.instance == null || NJG.UIMiniMapBase.inst == null)
            {
                return;
            }

            if (mRevealer == null)
            {
                mRevealer = NJGFOW.CreateRevealer();
            }

            if (isActive)
            {
                mRevealer.pos            = NJG.UIMiniMapBase.inst.WorldToMap(cachedTransform.position, false);
                mRevealer.revealDistance = revealDistance > 0 ? revealDistance : NJGMapBase.instance.fow.revealDistance;
                mRevealer.isActive       = true;
            }
            else
            {
                mRevealer.isActive = false;
            }
        }
    }
Exemple #3
0
 public static void DeleteRevealer(NJGFOW.Revealer rev)
 {
     FastList<NJGFOW.Revealer> obj = NJGFOW.mRemoved;
     lock (obj)
     {
         NJGFOW.mRemoved.Add(rev);
     }
 }
Exemple #4
0
        /// <summary>
        /// Remove this unit from the list.
        /// </summary>

        void OnDestroy()
        {
            if (Application.isPlaying)
            {
                if (NJGMap.instance != null && NJGMap.instance.fow.enabled)
                {
                    NJGFOW.DeleteRevealer(mRevealer);
                }
            }
        }
Exemple #5
0
    void Start()
    {
        if (NJGMapBase.instance != null)
        {
            if (revealFOW && NJGMapBase.instance.fow.enabled)
            {
                mRevealer = NJGFOW.CreateRevealer();
            }
        }

        //enabled = revealFOW;
    }
Exemple #6
0
    /// <summary>
    /// Remove this unit from the list.
    /// </summary>

    void OnDestroy()
    {
        if (Application.isPlaying)
        {
            if (NJGMapBase.instance != null)
            {
                if (NJGMapBase.instance.fow.enabled)
                {
                    NJGFOW.DeleteRevealer(mRevealer);
                }
            }
            mRevealer = null;
            if (arrow != null)
            {
                UIMiniMapBase.inst.DeleteArrow(arrow);
            }
            arrow = null;
        }
        list.Remove(this);
    }
Exemple #7
0
        void Start()
        {
            if (NJGMap.instance != null)
            {
                if (revealFOW && NJGMap.instance.fow.enabled)
                {
                    mRevealer = NJGFOW.CreateRevealer();
                }
            }

            if (miniMap != null)
            {
                icon  = miniMap.GetEntry(this);
                arrow = miniMap.GetArrow(this);
            }
            if (worldMap != null)
            {
                icon  = worldMap.GetEntry(this);
                arrow = worldMap.GetArrow(this);
            }

            mColorSet = false;
            //enabled = revealFOW;
        }
Exemple #8
0
 private void RevealAtPosition(NJGFOW.Revealer r, float worldToTex)
 {
     Vector2 vector = r.pos - this.mOrigin;
     int num = Mathf.RoundToInt((vector.x - (float)r.revealDistance) * worldToTex);
     int num2 = Mathf.RoundToInt((vector.y - (float)r.revealDistance) * worldToTex);
     int num3 = Mathf.RoundToInt((vector.x + (float)r.revealDistance) * worldToTex);
     int num4 = Mathf.RoundToInt((vector.y + (float)r.revealDistance) * worldToTex);
     int num5 = Mathf.RoundToInt(vector.x * worldToTex);
     int num6 = Mathf.RoundToInt(vector.y * worldToTex);
     int textureSize = this.map.fow.textureSize;
     num5 = Mathf.Clamp(num5, 0, textureSize - 1);
     num6 = Mathf.Clamp(num6, 0, textureSize - 1);
     int num7 = Mathf.RoundToInt((float)(r.revealDistance * r.revealDistance) * worldToTex * worldToTex);
     for (int i = num2; i < num4; i++)
     {
         if (i > -1 && i < textureSize)
         {
             int num8 = i * textureSize;
             for (int j = num; j < num3; j++)
             {
                 if (j > -1 && j < textureSize)
                 {
                     int num9 = j - num5;
                     int num10 = i - num6;
                     int num11 = num9 * num9 + num10 * num10;
                     if (num11 < num7)
                     {
                         this.mBuffer1[j + num8].r = 255;
                     }
                 }
             }
         }
     }
 }
Exemple #9
0
 void Start()
 {
     map = NJG.NJGMapBase.instance;
     fow = NJGFOW.instance;
 }