Example #1
0
    private void Awake()
    {
        if (objectLightEmission == null)
        {
            Debug.LogError($"{this} field objectLightEmission is null, please check {gameObject} prefab.");
            return;
        }

        objectLightSprite = objectLightEmission.GetComponent <Light2D.LightSprite>();
    }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        existTime -= Time.deltaTime;

        Light2D.LightSprite l = GetComponentInChildren <Light2D.LightSprite>();
        l.transform.localScale = new Vector3(existTime * 0.5f, existTime * 0.5f, 1);

        if (existTime < 0)
        {
            Destroy(gameObject);
        }
    }
Example #3
0
        public static void CreateLightSource()
        {
            GameObject obj = new GameObject("Light");

            if (LightingSystem.Instance != null)
            {
                obj.layer = LightingSystem.Instance.LightSourcesLayer;
            }
            LightSprite light = obj.AddComponent <LightSprite>();

            light.Material         = AssetDatabase.LoadAssetAtPath <Material>("Assets/Light2D/Materials/Light60Points.mat");
            light.Sprite           = Resources.Load <Sprite>("DefaultLight");
            light.Color            = new Color(1, 1, 1, 0.5f);
            Selection.activeObject = obj;
        }
    private void Awake()
    {
        PlayerLightData = new PlayerLightData()
        {
            Intensity  = Intensity,
            Colour     = Colour,
            EnumSprite = EnumSprite,
            Size       = Size,
        };

        if (objectLightEmission == null)
        {
            Logger.LogError($"{this} field objectLightEmission is null, please check {gameObject} prefab.", Category.Lighting);
            return;
        }

        objectLightSprite = objectLightEmission.GetComponent <Light2D.LightSprite>();
    }