Пример #1
0
    // Start is called before the first frame update
    void Start()
    {
        active = false;
        Lights = new GameObject[8];

        var angle  = 360f / Lights.Length;
        var radius = 0.1f;

        levelDj = GameObject.FindGameObjectWithTag("SoundController").GetComponent <LevelDj>();

        for (int i = 0; i < Lights.Length; i++)
        {
            Quaternion rotation  = Quaternion.AngleAxis(i * angle, Vector3.up);
            Vector3    direction = rotation * Vector3.forward;
            Vector3    position  = direction * radius;

            var go = new GameObject();

            go.transform.parent        = LightGroup.transform;
            go.transform.localPosition = position;
            go.transform.localRotation = Quaternion.Euler(new Vector3(0, i * angle, 0));

            var comp = go.AddComponent <Light>();
            comp.type            = LightType.Spot;
            comp.intensity       = 10;
            comp.spotAngle       = 30;
            comp.range           = 20;
            comp.shadows         = LightShadows.Hard;
            comp.shadowBias      = 0.01f;
            comp.shadowNearPlane = 0.1f;

            Lights[i] = go;
        }
    }
Пример #2
0
 // Start is called before the first frame update
 void Start()
 {
     active       = false;
     SpotOneLight = SpotOne.GetComponent <Light>();
     SpotTwoLight = SpotTwo.GetComponent <Light>();
     levelDj      = GameObject.FindGameObjectWithTag("SoundController").GetComponent <LevelDj>();
 }
    public void Start()
    {
        baseLightLight           = BaseLight.GetComponent <Light>();
        baseLightLight.intensity = 0;
        baseLightTransform       = BaseLight.transform;

        levelDj = GameObject.FindGameObjectWithTag("SoundController").GetComponent <LevelDj>();
    }