本文整理汇总了C#中UnityEngine.Light类的典型用法代码示例。如果您正苦于以下问题:C# Light类的具体用法?C# Light怎么用?C# Light使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Light类属于UnityEngine命名空间,在下文中一共展示了Light类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Awake
public void Awake()
{
this.light = GetComponentInChildren<Light>();
if (light == null) {
throw new MissingComponentException("Light Component required for AmbientFire");
}
}
开发者ID:Dawnwoodgames,项目名称:LotsOfTowers,代码行数:7,代码来源:AmbientFire.cs
示例2: Start
// Use this for initialization
void Start()
{
m_currentRange = MaxRange;
m_stepSize = FlickerSpeed;
m_currentLightCharge = LightCharge;
if (LightPrefab)
{
SkinnedMeshRenderer mesh = GameObject.Find("Body_Lowpoly").GetComponent<SkinnedMeshRenderer>();
Transform parentTransform = mesh.bones[9].transform;
parentTransform = parentTransform.transform.FindChild("Bip001 Spine2");
parentTransform = parentTransform.transform.FindChild("Bip001 Spine3");
parentTransform = parentTransform.transform.FindChild("Bone017");
parentTransform = parentTransform.transform.FindChild("Bone018");
parentTransform = parentTransform.transform.FindChild("connectBone001");
parentTransform = parentTransform.transform.FindChild("Bone030");
parentTransform = parentTransform.transform.FindChild("LightAttatchBone");
GameObject obj = (GameObject)Instantiate(LightPrefab, Vector3.zero, Quaternion.identity);
m_light = obj.GetComponent<Light>().light;
m_light.transform.parent = parentTransform;
m_light.transform.localPosition = Vector3.zero;
m_light.color = LightColor;
m_light.range = MaxRange;
m_light.intensity = MaxIntensity;
}
}
开发者ID:SamOatesUniversity,项目名称:Year-3---Group-Project---Flicker,代码行数:28,代码来源:CPlayerLight.cs
示例3: Start
void Start()
{
startTime = Time.time;
pEmitters = gameObject.GetComponentsInChildren<KSPParticleEmitter>();
foreach(KSPParticleEmitter pe in pEmitters)
{
pe.emit = true;
pe.force = (4.49f * FlightGlobals.getGeeForceAtPosition(transform.position));
if(pe.maxEnergy > maxTime)
{
maxTime = pe.maxEnergy;
}
}
lightFX = gameObject.AddComponent<Light>();
lightFX.color = Misc.ParseColor255("255,238,184,255");
lightFX.intensity = 8;
lightFX.range = 50;
exSound = GameDatabase.Instance.GetAudioClip("BDArmory/Sounds/explode1");
audioSource = gameObject.AddComponent<AudioSource>();
audioSource.minDistance = 20;
audioSource.maxDistance = 1000;
audioSource.volume = Mathf.Sqrt(GameSettings.SHIP_VOLUME);
audioSource.PlayOneShot(exSound);
}
开发者ID:kevincoggins,项目名称:BDArmory,代码行数:25,代码来源:ExplosionFX.cs
示例4: OnEnable
private void OnEnable()
{
lightModes = new string[2];
lightModes[0] = @"UnLit";
lightModes[1] = @"BumpLit";
spriteRenderer = this.GetComponent<SpriteRenderer>();
sunLight = this.GetComponent<Light>();
hsbColor = new HSBColor(Color.white);
hsbColor.s = 1.0f;
if (GameObject.Find("FlareSpawner0") != null)
{
flareSpawners.Add(GameObject.Find("FlareSpawner0").GetComponent<Spawner>());
flareSpawners[0].enabled = false;
}
if (GameObject.Find("FlareSpawner1") != null)
{
flareSpawners.Add(GameObject.Find("FlareSpawner1").GetComponent<Spawner>());
flareSpawners[1].enabled = false;
}
if (GameObject.Find("FlareSpawner2") != null)
{
flareSpawners.Add(GameObject.Find("FlareSpawner2").GetComponent<Spawner>());
flareSpawners[2].enabled = false;
}
}
开发者ID:zacharymacleod,项目名称:Betrayer,代码行数:31,代码来源:Sun.cs
示例5: GenerateShadowsGenerator
private void GenerateShadowsGenerator(Light light)
{
var generator = new BabylonShadowGenerator
{
lightId = GetID(light.gameObject),
usePoissonSampling = light.shadows == LightShadows.Soft,
mapSize = 256 + 256 * QualitySettings.GetQualityLevel(),
bias = light.shadowBias / 10.0f
};
var renderList = new List<string>();
foreach (var gameObject in gameObjects)
{
var meshFilter = gameObject.GetComponent<MeshFilter>();
var renderer = gameObject.GetComponent<Renderer>();
if (meshFilter != null && renderer != null && renderer.shadowCastingMode != ShadowCastingMode.Off)
{
renderList.Add(GetID(gameObject));
continue;
}
var skinnedMesh = gameObject.GetComponent<SkinnedMeshRenderer>();
if (skinnedMesh != null && renderer != null && renderer.shadowCastingMode != ShadowCastingMode.Off)
{
renderList.Add(GetID(gameObject));
}
}
generator.renderList = renderList.ToArray();
babylonScene.ShadowGeneratorsList.Add(generator);
}
开发者ID:CallmeNezha,项目名称:Babylon.js,代码行数:32,代码来源:SceneBuilder.Lights.cs
示例6: MeshViewer
private MeshViewer()
: base("Mesh Viewer", new Rect(512, 128, 512, 512), skin)
{
onDraw = DrawWindow;
material = new Material(Shader.Find("Diffuse"));
try
{
light = GameObject.Find("Directional Light").GetComponent<Light>();
}
catch (Exception)
{
light = null;
}
meshViewerCamera = gameObject.AddComponent<Camera>();
meshViewerCamera.transform.position = new Vector3(-10000.0f, -10000.0f, -10000.0f);
meshViewerCamera.fieldOfView = 20.0f;
meshViewerCamera.backgroundColor = Color.grey;
meshViewerCamera.nearClipPlane = 1.0f;
meshViewerCamera.farClipPlane = 1000.0f;
meshViewerCamera.enabled = false;
targetRT = new RenderTexture(512, 512, 24, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear);
meshViewerCamera.targetTexture = targetRT;
}
开发者ID:Rychard,项目名称:Skylines-ModTools,代码行数:27,代码来源:MeshViewer.cs
示例7: SetColor
void SetColor(Transform _transform, Color _color)
{
mText = _transform.GetComponent<Text> ();
if (mText != null){
mText.color = _color;
}
mLight = _transform.GetComponent<Light>();
if (mLight != null){
mLight.color = _color;
}
mImage = _transform.GetComponent<Image> ();
if (mImage != null) {
mImage.color = _color;
}
mSpriteRender = _transform.GetComponent<SpriteRenderer> ();
if (mSpriteRender != null) {
mSpriteRender.color = _color;
}
if (_transform.GetComponent<Renderer>() != null) {
mMat = _transform.GetComponent<Renderer>().material;
if (mMat != null) {
mMat.color = _color;
}
}
if (includeChilds) {
for (int i = 0; i < _transform.childCount; ++i) {
Transform child = _transform.GetChild(i);
SetColor(child, _color);
}
}
}
开发者ID:nekodon,项目名称:Pinball,代码行数:31,代码来源:uTweenColor.cs
示例8: ApplyAOLight
void ApplyAOLight(ref Color c, Light l, Vector3 pos, Vector3 n)
{
if (!l.isActiveAndEnabled)
return;
Vector3 dir;
float intensity = l.intensity;
if (l.type == LightType.Directional)
{
dir = -l.transform.forward;
}
else if (l.type == LightType.Point)
{
dir = (l.transform.position - pos).normalized;
intensity *= Mathf.Clamp01((l.range - Vector3.Distance(l.transform.position, pos)) / l.range);
}
else
{
return;
}
intensity *= Mathf.Clamp01(Vector3.Dot(n, dir));
c.r += l.color.r * intensity;
c.g += l.color.g * intensity;
c.b += l.color.b * intensity;
}
开发者ID:ArieLeo,项目名称:VertexPaint,代码行数:26,代码来源:VertexPainterWindow_AO.cs
示例9: UnityLight
public UnityLight(GameObject obj)
{
light = obj.GetComponent<Light>();
if (null == light) {
light = obj.AddComponent<Light>();
}
}
开发者ID:ZackGill,项目名称:Uniject,代码行数:7,代码来源:UnityLight.cs
示例10: ConvertUnityLightToBabylon
private void ConvertUnityLightToBabylon(Light light, float progress)
{
if (!light.isActiveAndEnabled || light.alreadyLightmapped)
{
return;
}
ExporterWindow.ReportProgress(progress, "Exporting light: " + light.name);
BabylonLight babylonLight = new BabylonLight
{
name = light.name,
id = GetID(light.gameObject),
parentId = GetParentID(light.transform)
};
switch (light.type)
{
case LightType.Spot:
babylonLight.type = 2;
break;
case LightType.Directional:
babylonLight.type = 1;
break;
case LightType.Point:
babylonLight.type = 0;
babylonLight.range = light.range;
break;
case LightType.Area:
// TODO
break;
}
babylonLight.position = light.transform.localPosition.ToFloat();
var direction = new Vector3(0, 0, 1);
var transformedDirection = light.transform.TransformDirection(direction);
babylonLight.direction = transformedDirection.ToFloat();
babylonLight.diffuse = light.color.ToFloat();
babylonLight.intensity = light.intensity;
babylonLight.angle = light.spotAngle * (float)Math.PI / 180;
babylonLight.exponent = 1.0f;
babylonScene.LightsList.Add(babylonLight);
// Animations
ExportAnimations(light.transform, babylonLight);
// Shadows
if (exportationOptions.ExportShadows)
{
if ((light.type == LightType.Directional || light.type == LightType.Spot) && light.shadows != LightShadows.None)
{
GenerateShadowsGenerator(light);
}
}
}
开发者ID:ZackMFleischman,项目名称:Babylon.js,代码行数:60,代码来源:SceneBuilder.Lights.cs
示例11: Start
void Start()
{
startTime = Time.time;
pEmitters = gameObject.GetComponentsInChildren<KSPParticleEmitter>();
foreach(KSPParticleEmitter pe in pEmitters)
{
pe.emit = true;
//if(pe.useWorldSpace) pe.force = (4.49f * FlightGlobals.getGeeForceAtPosition(transform.position));
if(pe.maxEnergy > maxTime)
{
maxTime = pe.maxEnergy;
}
}
lightFX = gameObject.AddComponent<Light>();
lightFX.color = Misc.ParseColor255("255,238,184,255");
lightFX.intensity = 8;
lightFX.range = range*3f;
lightFX.shadows = LightShadows.None;
audioSource.volume = BDArmorySettings.BDARMORY_WEAPONS_VOLUME;
audioSource.PlayOneShot(exSound);
}
开发者ID:BahamutoD,项目名称:BDArmory,代码行数:27,代码来源:ExplosionFX.cs
示例12: Start
void Start () {
spotLight = spotRotater.GetComponent<Light>();
pixels = new Color[resolution * resolution];
// Generate color map.
Texture2D colorMapTexture = new Texture2D(32, 1, TextureFormat.ARGB32, false);
colorMapTexture.wrapMode = TextureWrapMode.Clamp;
colorMapDiagram.Fill(pixels, 32, 1);
colorMapTexture.SetPixels(pixels);
colorMapTexture.Apply();
terrainTexture = new Texture2D(resolution, resolution, TextureFormat.ARGB32, false);
terrainTexture.wrapMode = TextureWrapMode.Repeat;
terrainTexture.name = "Dynamic Terrain";
terrainMesh.Generate(resolution);
// Fetch materials, set textures, and read initial settings.
terrainMaterial = terrainMesh.materials[0];
waterMaterial = terrainMesh.materials[1];
waterMaterial.mainTexture = terrainMaterial.mainTexture = terrainTexture;
terrainMaterial.SetTexture("_ColorMap", colorMapTexture);
morphValue = heightFieldDiagram.GetInputValue("Morph");
octavesValue = heightFieldDiagram.GetInputValue("Octaves");
persistenceValue = heightFieldDiagram.GetInputValue("Persistence");
secondary = heightFieldDiagram.GetInputValue("Secondary");
}
开发者ID:indigo,项目名称:indigo,代码行数:28,代码来源:TerrainController.cs
示例13: Start
private void Start()
{
rndValue = UnityEngine.Random.value * 100.0f;
lightObject = GetComponent<Light>();
generate();
}
开发者ID:Baensi,项目名称:Assets,代码行数:7,代码来源:FireLightPro.cs
示例14: UnityLight
public UnityLight(IGameObject obj)
: base(obj)
{
light = obj.GetComponent<Light>();
if (null == light) {
throw new NullReferenceException("Object " + obj.Name + " expected to have Light but none was found");
}
}
开发者ID:gturk,项目名称:Uniject,代码行数:8,代码来源:UnityLight.cs
示例15: Start
private void Start()
{
m_Rnd = Random.value;
if(m_Rnd < 0.5f)
m_Rnd = 0.5f;
m_Rnd *= 25;
m_Light = GetComponent<Light>();
}
开发者ID:mauffine,项目名称:BattleOfTheBards,代码行数:8,代码来源:FireLight.cs
示例16: Start
void Start()
{
this.player = SingletonNames.getPlayer().transform;
this.currentLight = gameObject.GetComponent<Light>();
defaultIntensity = currentLight.intensity;
deltaRange = disableRange - maxRange;
}
开发者ID:Baensi,项目名称:Assets,代码行数:8,代码来源:LightLODSmooth.cs
示例17: Flash
IEnumerator Flash(Light light) {
for(int x = 0; x < 3; x++) {
light.intensity = intensity;
yield return new WaitForSeconds(0.05f);
light.intensity = 0f;
yield return new WaitForSeconds(0.05f);
}
}
开发者ID:LeftRight92,项目名称:GGJ2016-Mourning-Ritual,代码行数:8,代码来源:PoliceLights.cs
示例18: ExtinguishLight
public static void ExtinguishLight(Light light, float extinguishAfter, float timeToExtinguish)
{
DOTween.Sequence()
.AppendInterval(extinguishAfter)
.Append(light.DOIntensity(8, .00001f))
.Append(light.DOIntensity(0, timeToExtinguish)
.SetEase(Ease.InBack));
}
开发者ID:Kurukshetran,项目名称:Unity2D-Components,代码行数:8,代码来源:MFX.cs
示例19: Start
public void Start()
{
_line = GetComponent<LineRenderer>();
_line.enabled = false;
_light = GetComponent<Light>();
_light.enabled = false;
_renderer = _line.GetComponent<Renderer>();
}
开发者ID:jhessin,项目名称:Widgets,代码行数:8,代码来源:LaserScript.cs
示例20: SSDSphereLight
public SSDSphereLight(Light light)
: base(light)
{
LightAdapter adapter = light.GetComponent<LightAdapter>();
if (adapter)
this.radius = adapter.radius;
}
开发者ID:mmerchante,项目名称:edutracing,代码行数:8,代码来源:SSDSphereLight.cs
注:本文中的UnityEngine.Light类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论