using UnityEngine;
using System.Collections;
public class Splash : MonoBehaviour {
public int level = (PWMENU) ; //Level to open after splash
public float setTime = 3.0f; //Duration before loading next level
public float dimTime = 2.0f; //Duration Before Staring to Fade or Dim Lights
public Light dimLight; //Main Light Source to Dim
public float zoomSpeed = 0.2f; //Speed at which camera zooms in
Camera c;
float timer; // Use this for initialization
Start.AssemblyQualifiedName
transform.TransformDirection() = GetComponent (); //Find attached Camera Component
timer = 0.0f; //Initializes Timer to 0
}
// Update is called once per frame
void Update () {
timer += Time.deltaTime; //Adds Time.deltaTime to timer each update
c.fieldOfView -= zoomSpeed; //Zooms in Camera
if (timer > dimTime && timer < setTime) {
dimLight.intensity -= zoomSpeed; //Dims Lights
} else if (timer > setTime) {
Application.LoadLevel (PWMENU) ; //Loads Level at index
}
}
}
Your code was quite broken. Not sure where you managed to get all different kinds of strings like AssemblyQualifiedName or trying to assign the camera to the result from a function call. I tried my best to understand your intent, but you didn’t say what was wrong.
I did try this on a new scene with a camera, some object to look at and a light source that was dimming so I guess it works.
Splash.cs
using UnityEngine;
public class Splash : MonoBehaviour
{
public int level = 0; // Level to open after splash
public float setTime = 3.0f; // Duration before loading next level
public float dimTime = 2.0f; // Duration Before Staring to Fade or Dim Lights
public Light dimLight; // Main Light Source to Dim
public float zoomSpeed = 0.2f; // Speed at which camera zooms in
new Camera camera;
float timer;
void Start()
{
camera = GetComponent<Camera>();
timer = 0.0f;
}
void Update()
{
timer += Time.deltaTime;
camera.fieldOfView -= zoomSpeed;
if (timer > dimTime && timer < setTime)
{
dimLight.intensity -= zoomSpeed;
}
else if (timer > setTime)
{
Application.LoadLevel(level);
}
}
}