Beispiel #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);
        }
    }
Beispiel #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;
            }
        }
Beispiel #3
0
 public Arrow(Vector2 location, SpriteBatch batch)
 {
     this.location = location;
     spriteBatch   = batch;
     this.sprite   = ItemFactory.Instance.CreateArrowSprite();
 }
Beispiel #4
0
 public Fairy(Vector2 location, SpriteBatch batch)
 {
     this.location    = location;
     this.sprite      = ItemFactory.Instance.CreateFariySprite();
     this.spriteBatch = batch;
 }
Beispiel #5
0
 public Rupy(Vector2 location, SpriteBatch batch)
 {
     this.location = location;
     this.sprite   = ItemFactory.Instance.CreateRupySprite();
     spriteBatch   = batch;
 }
Beispiel #6
0
 public Clock(Vector2 location, SpriteBatch batch)
 {
     this.location = location;
     spriteBatch   = batch;
     sprite        = ItemFactory.Instance.CreateClockSprite();
 }
Beispiel #7
0
 public OldMan(Vector2 location, SpriteBatch batch)
 {
     this.location = location;
     spriteBatch   = batch;
     sprite        = ItemFactory.Instance.CreateOldManSprite();
 }
Beispiel #8
0
 public HeartContainer(Vector2 location, SpriteBatch batch)
 {
     this.location = location;
     spriteBatch   = batch;
     sprite        = ItemFactory.Instance.CreateHeartConttainerSprite();
 }
Beispiel #9
0
 public Triforce(Vector2 location, SpriteBatch batch)
 {
     this.location = location;
     spriteBatch   = batch;
     sprite        = ItemFactory.Instance.CreateTriforceSprite();
 }
Beispiel #10
0
 public Sword(Vector2 location, SpriteBatch batch)
 {
     this.location = location;
     spriteBatch   = batch;
     this.sprite   = ItemFactory.Instance.CreateSwordSprite();
 }
Beispiel #11
0
 public Metal(Image imageMetal)
 {
     Image = imageMetal;
     Timer = 0f;
     state = Shining.Init;
 }
Beispiel #12
0
 public Compass(Vector2 location, SpriteBatch batch)
 {
     sprite        = ItemFactory.Instance.CreateCompassSprite();
     this.location = location;
     spriteBatch   = batch;
 }