using UnityEngine;
using System.Collections;
public class ContorleSol : MonoBehaviour
{
public Light Sun;
bool Luz = true;
// Use this for initialization
void Start ()
{
Sun = GetComponent();
}
// Update is called once per frame
void Update ()
{
if(Input.GetMouseButtonDown(1))
{
if (Light)
Sun.enabled = false;
Luz=false;
}
else
{
Sun.enabled = true;
Luz = true;
}
}
if(Luz)
{
if(Input.GetKey(KeyCode.PageUp))
Sun.intensity += 0.05f;
if(Input.GetKey(KeyCode.PageDown))
Sun.intensity -= 0.05f;
if(Sun.intesity >= 7)
Sun.color = Color.red;
else if(Sun.intesity <= 2)
Sun.color = Color.black;
else
Sun.color = Color.yellow;
}
}
↧