Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        float velocity = 0;
        float radius   = lightMask.Radius;

        if (Time.time > flickerTime)
        {
            /*if(radius >= maxRadius)
             *  radius = Mathf.SmoothDamp(radius, 0, ref velocity, FlickerCooldown);
             * else if(radius <= 0)
             *  radius = Mathf.SmoothDamp(radius, maxRadius, ref velocity, FlickerCooldown);*/
            lightMask   = LightManager.Instance.CreateLight(transform.position, LightPower);
            flickerTime = Time.time + FlickerCooldown;
        }
    }
Exemple #2
0
 public void DestroyLight(LightMask light)
 {
     _objectPool.DestroyObject(light);
 }
Exemple #3
0
 // Use this for initialization
 void Start()
 {
     lightMask   = LightManager.Instance.CreateLight(transform.position, LightPower);
     flickerTime = Time.time + FlickerCooldown;
 }
Exemple #4
0
 public Bitmap GetLightImage()
 {
     if (LightImage == null)
     {
         LightMask Mask = new LightMask(Image);
         LightImage = Mask.Image;
         if (LightImage != null)
         {
             LightWidth = (short)Mask.Image.Width;
             LightHeight = (short)Mask.Image.Height;
             LightColor = AverageColorFromTexture();
             LightX = (short)(Mask.OffsetX + X);
             LightY = (short)(Mask.OffsetY + Y);
             //LightFBytes = ConvertBitmapToArray(Mask.Image);
         }
         else
         {
             LightWidth = 0;
             LightHeight = 0;
             LightFBytes = new byte[0];
             LightColor = Color.White;
         }
         Mask = null;
     }
     
     return LightImage;
 }