コード例 #1
0
 void Start()
 {
     lights     = GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
     sprite     = GetComponent <SpriteRenderer>();
     sound      = GetComponent <AudioSource>();
     LifeSystem = FindObjectOfType <LiveCounterScript>();
 }
コード例 #2
0
ファイル: lightFlicker.cs プロジェクト: adawsonjc/LightGame
 //Get the point light and store that locally here
 //GET 2d box COLLIDER AND STORE THAT HERE
 //set variable for how many flickers per second
 //in update get random number, disable everything, enable after the flicker time
 void Start()
 {
     light            = gameObject.GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
     collider         = gameObject.GetComponent <CircleCollider2D>();
     flickerDuration  = 3f;
     flickerStartTime = Time.time;
 }
コード例 #3
0
ファイル: IcicleManager.cs プロジェクト: sigmund-c/fires
    public float IceDrop()
    {
        int leftRight = Random.Range(0, 2);

        switch (leftRight)
        {
        case 0:
            spawnPoses   = icicleLeftPoses;
            spawnTimes   = new float[icicleLeftPos.childCount];
            spawnObjects = new GameObject[icicleLeftPos.childCount];
            usedLight    = lightLeft;
            usedAudio    = audioLeft;
            break;

        case 1:
            spawnPoses   = icicleRightPoses;
            spawnTimes   = new float[icicleRightPos.childCount];
            spawnObjects = new GameObject[icicleRightPos.childCount];
            usedLight    = lightRight;
            usedAudio    = audioRight;
            break;
        }
        float currentTime = Time.time;

        for (int i = 0; i < spawnTimes.Length; i++)
        {
            spawnTimes[i] = currentTime + ((i + 1) * icicleSpawnDelay);
        }

        isTriggered         = true;
        usedLight.enabled   = true;
        usedLight.intensity = 0;
        usedAudio.Play();
        return(5.0f);
    }
コード例 #4
0
 void Start()
 {
     myCamera          = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>();
     globalLight       = GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
     colourArrayIndex  = 6;
     globalLight.color = colours[colourArrayIndex];
 }
コード例 #5
0
 // Start is called before the first frame update
 void Start()
 {
     renderer          = GetComponent <SpriteRenderer>();
     currentTransition = AlphaTransition.OpaqueToAlpha;
     duration          = interpolateDuration;
     light2DComponent  = lightObject.GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
 }
コード例 #6
0
ファイル: IcicleManager.cs プロジェクト: sigmund-c/fires
    void Start()
    {
        spawnCounter     = 0;
        isTriggered      = false;
        icicleLeftPos    = transform.Find("IciclePosManager_Left");
        icicleLeftPoses  = new Transform[icicleLeftPos.childCount];
        icicleRightPos   = transform.Find("IciclePosManager_Right");
        icicleRightPoses = new Transform[icicleLeftPos.childCount];
        for (int i = 0; i < icicleLeftPos.childCount; i++)
        {
            icicleLeftPoses[i] = icicleLeftPos.GetChild(i);
        }
        for (int i = 0; i < icicleRightPos.childCount; i++)
        {
            icicleRightPoses[i] = icicleRightPos.GetChild(i);
        }

        lightLeft         = GameObject.Find("IcicleLight_Left").GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
        lightRight        = GameObject.Find("IcicleLight_Right").GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
        lightMaxIntensity = lightLeft.intensity;
        lightTimer        = lightTimerValue;

        audioLeft  = GameObject.Find("Audio_Left").GetComponent <AudioSource>();
        audioRight = GameObject.Find("Audio_Right").GetComponent <AudioSource>();
    }
コード例 #7
0
    private void UpdateLight()
    {
        if (shapeLight != null)
        {
            Destroy(shapeLight.gameObject);
        }

        GameObject light = Instantiate(lightPrefab, transform.position, Quaternion.identity);

        light.transform.SetParent(transform);

        shapeLight = light.GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();

        float startAngle = angle / 2;

        for (int i = 0; i < 10; i++)
        {
            startAngle += angle / 10;

            RaycastHit2D hit = Physics2D.Raycast(transform.position, Quaternion.Euler(0, 0, startAngle) * transform.rotation * Vector3.right, distance, lightLayer);

            if (hit.collider == null)
            {
                shapeLight.shapePath[i] = Quaternion.Euler(0, 0, startAngle) * transform.rotation * Vector3.right * distance;
            }
            else
            {
                shapeLight.shapePath[i] = transform.worldToLocalMatrix * hit.point;
            }
        }

        shapeLight.shapePath[10] = Vector3.zero;

        // SetFieldValue<Vector3[]>(shapeLight, "m_ShapePath", points);
    }
コード例 #8
0
 // Start is called before the first frame update
 void Start()
 {
     light2D       = GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
     baseIntensity = light2D.intensity;
     high          = false;
     StartCoroutine(lerpLight(start, end, time));
 }
コード例 #9
0
    // Start is called before the first frame update
    void Start()
    {
        Transform player = InstanceManager <GameManager> .GetInstance("GameManager").Player.transform;

        transform.localScale = (player.transform.localScale / Random.Range(20, 10));
        light2D = GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
        float intensity;
        float radius;

        if (player.localScale.x >= 0.3f)
        {
            intensity = 0.5f;
            radius    = 1f;
        }
        else if (player.localScale.x >= 2f)
        {
            intensity = 1f;
            radius    = 2f;
        }
        else
        {
            intensity = 0.1f;
            radius    = 0.2f;
        }
        light2D.intensity             = intensity;
        light2D.pointLightOuterRadius = radius;
    }
コード例 #10
0
 void Start()
 {
     light2d = GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
     light2d.pointLightOuterRadius = 0;
     player           = GameObject.Find("Player").transform;
     playerController = FindObjectOfType <PlayerController>();
 }
コード例 #11
0
 public void SetZone()
 {
     isDead          = false;
     lightController = GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
     lightController.pointLightOuterRadius     = zoneRadius;
     GetComponent <CircleCollider2D>().enabled = true;
     GetComponent <CircleCollider2D>().radius  = zoneRadius;
 }
コード例 #12
0
 void Start()
 {
     playerLight           = GameObject.Find("Player").GetComponent <Light2D>();
     playerLight.intensity = 0;
     // light.color = new Vector4(0.83f, 0.81f, 0.42f, 1);
     precipitation = ParameterManager.instance.precipitation;
     season        = GameObject.Find("ParametersManager").GetComponent <ParameterManager>().startSeason;
     changeSeason();
 }
コード例 #13
0
    // Start is called before the first frame update
    void Start()
    {
        rigidbody2d = GetComponent <Rigidbody2D>();
        GameObject mPlayerLight = GameObject.FindWithTag("PlayerLight");

        playerLight   = mPlayerLight.GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
        currentHealth = 1;
        ChangeHealth(4);
    }
コード例 #14
0
    void Start()
    {
        playerRb = GetComponent <Rigidbody2D>();
        sprRend  = GetComponent <SpriteRenderer>();
        anim     = GetComponent <Animator>();
        myLight  = GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();

        attackCooldown = attackCooldownTime;
    }
コード例 #15
0
 void Start()
 {
     smoothQueue = new Queue <float>(smoothing);
     // External or internal light?
     if (light == null)
     {
         light = GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
     }
 }
コード例 #16
0
 void Start()
 {
     myLight = this.GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
     //myLight.color = Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f);
     if (hasRandomSpeed)
     {
         pulseSpeed = Random.Range(minPulseSpeed, maxPulseSpeed);
     }
 }
コード例 #17
0
    private float tmpv;                    //Velocidad original de Lucy, se guarda para que cuando cambie pueda regresar a su estado original

    void Start()
    {
        //Se inician los componentes necesarios
        col        = GetComponent <CircleCollider2D>();
        lt         = GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
        col.radius = sizeRad;
        lt.pointLightOuterRadius = 2f;
        tmpv = MainChar.spd;
        transform.gameObject.tag = "detectable"; //Lucy se establece como detectable
    }
コード例 #18
0
    //public ParticleSystem WeatherParticleSys;
    // Start is called before the first frame update
    void Start()
    {
        Sun = GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
        WeatherNameText.text = weatherState.WeatherName;
        var ps = GetComponent <ParticleSystem>();
        var As = GetComponent <AudioSource>();

        As.clip = weatherState.SoundClip;
        As.Play();
    }
コード例 #19
0
ファイル: TImeObject.cs プロジェクト: dani2221/Laitz
 void Start()
 {
     joint          = gameObject.AddComponent <FixedJoint2D>();
     joint1         = gameObject.AddComponent <FixedJoint2D>();
     joint.enabled  = false;
     joint1.enabled = false;
     rightleg       = GameObject.FindGameObjectsWithTag("Attach");
     leftleg        = GameObject.FindGameObjectsWithTag("AttachLeft");
     light          = GetComponentInChildren <UnityEngine.Experimental.Rendering.Universal.Light2D>();
     particle.Stop();
 }
コード例 #20
0
    private void Awake()
    {
        GhostGlow     = GetComponentInChildren <UnityEngine.Experimental.Rendering.Universal.Light2D>();
        ghostRenderer = GetComponentInChildren <SpriteRenderer>();
        happiness     = GetComponentInChildren <HealthBarScript>();

        if (_questItemPrefab)
        {
            hasQuest = true;
        }
    }
コード例 #21
0
ファイル: ReadCollectible.cs プロジェクト: sigmund-c/fires
 new void Start()
 {
     setLight    = true;
     light       = GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
     audioSource = GetComponent <AudioSource>();
     if (textManager == null)
     {
         textManager = GameObject.Find("TextManager").GetComponent <TextManager>();
     }
     base.Start();
 }
コード例 #22
0
    void Start()
    {
        pv          = GetComponent <PhotonView>();
        globalLight = GetComponent <Light2D>();

        maxTime = dayTime + dayToNightTime + nightTime + nightToDayTime;
        if (SceneManager.GetActiveScene().name != "Tutorial")
        {
            StartCoroutine(cor());
            spawner.DaybyDay(day);
        }
    }
コード例 #23
0
 private void Awake()
 {
     laserTriggered = false;
     volumeProfile.TryGet(out bloom);
     // bloomIntensityDefault = bloom.intensity.value;
     m_transform    = GetComponent <Transform>();
     m_lineRenderer = GetComponent <LineRenderer>();
     particleSystem = GetComponent <ParticleSystem>();
     light          = GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
     col            = GetComponent <Collider2D>();
     audioSource    = GetComponent <AudioSource>();
 }
コード例 #24
0
ファイル: Torch.cs プロジェクト: duriumm/Pixel-Game
    void Start()
    {
        fireParticleEffect              = this.gameObject.GetComponent <ParticleSystem>();
        torch2dLightComponent           = this.gameObject.GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
        torch2dLightComponent.intensity = maxTorchLightIntensity;



        isTorchActive = false;
        fireParticleEffect.Stop();
        torch2dLightComponent.enabled = false;
    }
コード例 #25
0
    // Start is called before the first frame update
    void Start()
    {
        myLight = GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();

        if (myLight == null)
        {
            Debug.LogError("Flicker script must have a Light Component on the same GameObject.");
            return;
        }
        _baseIntensity = myLight.intensity;
        StartCoroutine(DoFlicker());
    }
コード例 #26
0
    void Start()
    {
        rb2d           = GetComponent <Rigidbody2D>();
        spriteRenderer = GetComponent <SpriteRenderer>();
        animator       = GetComponent <Animator>();
        xScale         = rb2d.transform.localScale;

        globalLight                = GameObject.Find("Global Light").GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
        brightLightRight           = GameObject.Find("Right Eye Bright Light").GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
        brightLightLeft            = GameObject.Find("Left Eye Bright Light").GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
        brightLightRight.intensity = defaultLightRight;
        brightLightLeft.intensity  = defaultLightLeft;
    }
コード例 #27
0
    // Start is called before the first frame update
    void Start()
    {
        rb = gameObject.GetComponent <Rigidbody2D>();

        audioSource       = gameObject.GetComponent <AudioSource>();
        gunfire           = gameObject.transform.Find("Gunfire").GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
        torchCollider     = gameObject.transform.Find("Torch").GetComponent <TorchCollider>();
        rb.freezeRotation = true;
        startPos          = transform.position;
        playerAnimator    = gameObject.GetComponent <Animator>();

        torchInnerRadius = torch.pointLightInnerRadius;
        torchOuterRadius = torch.pointLightOuterRadius;
        torchInnerAngle  = torch.pointLightInnerAngle;
        torchOuterAngle  = torch.pointLightOuterAngle;
    }
コード例 #28
0
        public static void ErrorIfDuplicateGlobalLight(Light2D light)
        {
            if (light.lightType != Light2D.LightType.Global)
            {
                return;
            }

            foreach (var sortingLayer in light.affectedSortingLayers)
            {
                // should this really trigger at runtime?
                if (ContainsDuplicateGlobalLight(sortingLayer, light.blendStyleIndex))
                {
                    Debug.LogError("More than one global light on layer " + SortingLayer.IDToName(sortingLayer) + " for light blend style index " + light.blendStyleIndex);
                }
            }
        }
コード例 #29
0
        static Material CreateLightMaterial(Light2D light, bool isVolume)
        {
            bool     isShape = light.IsShapeLight();
            Material material;

            if (isVolume)
            {
                material = CoreUtils.CreateEngineMaterial(isShape ? s_Renderer2DData.shapeLightVolumeShader : s_Renderer2DData.pointLightVolumeShader);
            }
            else
            {
                material = CoreUtils.CreateEngineMaterial(isShape ? s_Renderer2DData.shapeLightShader : s_Renderer2DData.pointLightShader);

                if (!light.alphaBlendOnOverlap)
                {
                    SetBlendModes(material, BlendMode.One, BlendMode.One);
                    material.EnableKeyword(k_UseAdditiveBlendingKeyword);
                }
                else
                {
                    SetBlendModes(material, BlendMode.SrcAlpha, BlendMode.OneMinusSrcAlpha);
                }
            }

            if (light.lightType == Light2D.LightType.Sprite)
            {
                material.EnableKeyword(k_SpriteLightKeyword);
            }

            if (!isShape && light.lightCookieSprite != null && light.lightCookieSprite.texture != null)
            {
                material.EnableKeyword(k_UsePointLightCookiesKeyword);
            }

            if (!isShape && light.pointLightQuality == Light2D.PointLightQuality.Fast)
            {
                material.EnableKeyword(k_LightQualityFastKeyword);
            }

            if (light.useNormalMap)
            {
                material.EnableKeyword(k_UseNormalMap);
            }

            return(material);
        }
コード例 #30
0
 // Start is called before the first frame update
 void Start()
 {
     source           = GetComponent <AudioSource>();
     lt               = GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>();
     blower           = Random.Range(blowermin, blowermax);
     bupper           = Random.Range(buppermin, buppermax);
     slower           = Random.Range(slowermin, slowermax);
     supper           = Random.Range(suppermin, suppermax);
     period           = Random.Range(0.8f, 3.0f);
     t                = 0.0f;
     n                = Random.Range(0, chord.Length);
     note             = chord[n];
     source.clip      = note;
     xsquare          = Mathf.Pow(transform.position.x, 2);
     source.panStereo = Mathf.Sign(transform.position.x) * (xsquare / (1 + xsquare));
     source.Play();
 }