Ejemplo n.º 1
0
    private void reloadLight()
    {
        var LightingObjects = GameObject.FindGameObjectsWithTag("Lighting");
        // Debug.Log("Mask Update LightingObjects.Count=" + LightingObjects.Length);
        List <Vector4> pointLights = new List <Vector4>();

        int            pointCount = 0;
        List <Vector4> lineLights = new List <Vector4>();

        int lineCount = 0;
        // Debug.Log("Screen.width=" + Screen.width + ",Screen.height=" + Screen.height);
        var asW = Screen.width / 1080f;
        var asH = Screen.height / 1920f;

        foreach (var obj in LightingObjects)
        {
            Shining sh = obj.gameObject.GetComponent <Shining>();
            if (sh.LightShape == 1 && sh.P1 > 0)
            {
                // Debug.Log("Lighting if Object Name=" + obj.name);
                pointLights.Add(sh.GetPointLightInfo());
                pointCount++;
            }
            else if (sh.LightShape == 2 && sh.P1 > 0)
            {
                // Debug.Log("Lighting else if Object Name=" + obj.name);
                foreach (var e in sh.GetLineLightList())
                {
                    // Debug.Log("Lighting Object Name=" + obj.name + ",e=" + e);
                    lineLights.Add(e);
                    lineCount++;
                }
            }
            else
            {
                // Debug.Log("Lighting else Object Name=" + obj.name);
            }
        }
        for (int i = pointCount; i < 30; i++)
        {
            pointLights.Add(new Vector4());
        }

        for (int i = lineCount; i < 90; i++)
        {
            lineLights.Add(new Vector4());
        }
        spriteRenderer.material.SetFloat("_Alpha", spriteRenderer.color.a);

        spriteRenderer.material.SetVectorArray("_LightingArr", pointLights);
        spriteRenderer.material.SetFloat("_LightingArrLen", pointCount);
        spriteRenderer.material.SetFloat("_LineLightingArrLen", lineCount);
        if (lineLights.Count > 0)
        {
            // Debug.Log("Lighting lineLights.Count=" + lineLights.Count + ",lineCount=" + lineCount);
            spriteRenderer.material.SetVectorArray("_LineLightingArr", lineLights);
        }
    }
Ejemplo n.º 2
0
        public void MetalShining()
        {
            switch (state)
            {
            case Shining.Init:
            {
                Image.color = new Color(1, 1, 1, 0);
            }
            break;

            case Shining.Hide:
            {
                Timer       += Time.deltaTime;
                Image.color += new Color(0, 0, 0, 0.3f);
                if (Timer > 0.2f)
                {
                    state = Shining.Show;
                    Timer = 0f;
                }
            }
            break;

            case Shining.Show:
            {
                Timer       += Time.deltaTime;
                Image.color -= new Color(0, 0, 0, 0.3f);
                if (Timer > 0.6f)
                {
                    Image.color = new Color(1, 1, 1, 0);
                    state       = Shining.Hide;
                    Timer       = 0f;
                }
            }
            break;
            }
        }
Ejemplo n.º 3
0
 public Arrow(Vector2 location, SpriteBatch batch)
 {
     this.location = location;
     spriteBatch   = batch;
     this.sprite   = ItemFactory.Instance.CreateArrowSprite();
 }
Ejemplo n.º 4
0
 public Fairy(Vector2 location, SpriteBatch batch)
 {
     this.location    = location;
     this.sprite      = ItemFactory.Instance.CreateFariySprite();
     this.spriteBatch = batch;
 }
Ejemplo n.º 5
0
 public Rupy(Vector2 location, SpriteBatch batch)
 {
     this.location = location;
     this.sprite   = ItemFactory.Instance.CreateRupySprite();
     spriteBatch   = batch;
 }
Ejemplo n.º 6
0
 public Clock(Vector2 location, SpriteBatch batch)
 {
     this.location = location;
     spriteBatch   = batch;
     sprite        = ItemFactory.Instance.CreateClockSprite();
 }
Ejemplo n.º 7
0
 public OldMan(Vector2 location, SpriteBatch batch)
 {
     this.location = location;
     spriteBatch   = batch;
     sprite        = ItemFactory.Instance.CreateOldManSprite();
 }
Ejemplo n.º 8
0
 public HeartContainer(Vector2 location, SpriteBatch batch)
 {
     this.location = location;
     spriteBatch   = batch;
     sprite        = ItemFactory.Instance.CreateHeartConttainerSprite();
 }
Ejemplo n.º 9
0
 public Triforce(Vector2 location, SpriteBatch batch)
 {
     this.location = location;
     spriteBatch   = batch;
     sprite        = ItemFactory.Instance.CreateTriforceSprite();
 }
Ejemplo n.º 10
0
 public Sword(Vector2 location, SpriteBatch batch)
 {
     this.location = location;
     spriteBatch   = batch;
     this.sprite   = ItemFactory.Instance.CreateSwordSprite();
 }
Ejemplo n.º 11
0
 public Metal(Image imageMetal)
 {
     Image = imageMetal;
     Timer = 0f;
     state = Shining.Init;
 }
Ejemplo n.º 12
0
 public Compass(Vector2 location, SpriteBatch batch)
 {
     sprite        = ItemFactory.Instance.CreateCompassSprite();
     this.location = location;
     spriteBatch   = batch;
 }