Beispiel #1
0
 void Update()
 {
     if (!isLocalPlayer)
     {
         return;
     }
     if (radius <= 0)
     {
         return;
     }
     if (m_OriginPosition != transform.position)
     {
         m_OriginPosition = transform.position;
         var pos = FogOfWarEffect.WorldPositionToFOW(transform.position);
         if (m_FowMapPos.x != pos.x || m_FowMapPos.y != pos.y || !m_IsInitialized)
         {
             m_FowMapPos          = pos;
             m_IsInitialized      = true;
             m_FieldData.position = transform.position;
             m_FieldData.radius   = radius;
             //FogOfWarEffect.SetVisibleAtPosition(m_FieldData);
             FogOfWarEffect.UpdateFOWFieldData(m_FieldData);
         }
     }
 }
 void OnDestroy()
 {
     if (m_FieldData != null)
     {
         FogOfWarEffect.ReleaseFOWFieldData(m_FieldData);
     }
     m_FieldData = null;
 }
 void FixedUpdate()
 {
     m_RequestTime += Time.deltaTime;
     if (m_RequestTime > 0.3f)
     {
         m_RequestTime = 0;
         bool visible = FogOfWarEffect.IsVisibleInMap(transform.position);
         SetVisible(visible);
     }
 }
Beispiel #4
0
 void OnDestroy()
 {
     if (!isLocalPlayer)
     {
         return;
     }
     if (m_FieldData != null)
     {
         FogOfWarEffect.ReleaseFOWFieldData(m_FieldData);
     }
     m_FieldData = null;
 }
    void Update()
    {
        if (radius <= 0)
        {
            return;
        }
        var pos = FogOfWarEffect.WorldPositionToFOW(transform.position);

        if (m_FowMapPos.x != pos.x || m_FowMapPos.y != pos.y || first_time)
        {
            m_FowMapPos          = pos;
            first_time           = true;
            m_FieldData.position = transform.position;
            m_FieldData.radius   = radius;
            //FogOfWarEffect.SetVisibleAtPosition(m_FieldData);
            FogOfWarEffect.UpdateFOWFieldData(m_FieldData);
        }
    }
Beispiel #6
0
 void OnDestroy()
 {
     if (m_Renderer != null)
     {
         m_Renderer.Release();
     }
     if (m_Map != null)
     {
         m_Map.Release();
     }
     if (m_FieldDatas != null)
     {
         m_FieldDatas.Clear();
     }
     m_FieldDatas = null;
     m_Renderer   = null;
     m_Map        = null;
     instance     = null;
 }
Beispiel #7
0
    void Update()
    {
        if (player != null)
        {
            if (maskImage.texture == null)
            {
                maskImage.texture = FogOfWarEffect.Instance.minimapMask;
            }
//	        //if (maskTexture == null)
//	        {
//	            maskTexture = FogOfWarEffect.Instance.fowMaskTexture;
//                map.material.SetTexture("_MiniMap", maskTexture);
//            }
            Vector2 p = FogOfWarEffect.WorldPositionTo2DLocal(player.position);
            p.x = -p.x * map.rectTransform.rect.width;
            p.y = -p.y * map.rectTransform.rect.height;

            map.rectTransform.anchoredPosition = p;
        }
    }
Beispiel #8
0
    // Use this for initialization
    void Start()
    {
        GetComponent <RectTransform> ().localPosition = new Vector3(0, 0, 0);
        timeSlider.onValueChanged.AddListener(delegate(float arg0) {
            if (arg0 == timeSlider.minValue)
            {
                timeSlider.maxValue = NightTime;
                isNight             = true;
                m_OnDayNightChange.Invoke(isNight);
            }
            else if (arg0 == timeSlider.maxValue)
            {
                timeSlider.value = timeSlider.maxValue = DayTime;
                isNight          = false;
                m_OnDayNightChange.Invoke(isNight);
            }
        });

        onDayNightChanged.AddListener(delegate(bool arg0) {
            SpyButton.SetActive(arg0);
            if (arg0)
            {
                Camera.main.gameObject.AddComponent <FogOfWarEffect>();
            }
            else
            {
                FogOfWarEffect fow = Camera.main.GetComponent <FogOfWarEffect>();
                if (fow)
                {
                    Destroy(fow);
                }
            }
        });

        if (isServer)
        {
            timeSlider.value = timeSlider.maxValue;
            StartCoroutine(Timer());
        }
    }
 void OnEnable()
 {
     m_Target = (FogOfWarEffect)target;
 }