I have added the animations and done all the code but the door will not open. Please could you have a look at the code and see what is happening? C# please :)
using UnityEngine;
using System.Collections;
public class DoorControl : MonoBehaviour {
private Animation _anim;
public bool doorOpen;
void Start()
{
}
void Update ()
{
if(Input.GetKeyDown(KeyCode.Q))
{
OpenDoor();
}
}
void OpenDoor()
{
if (doorOpen == true) {
_anim.Play ("ClosingAnimation");
doorOpen = false;
}
else
{
_anim.Play("OpenAnimation");
doorOpen = true;
}
}
}
↧