I'm making a maze in Unity and within my maze I have walls that move.. These walls are placed inside hallways or whatever and they have have a random determined time to open and then another random time determined to close.
It down't work saying my animation can't be found. Please help!
![alt text][1]
[1]: http://puu.sh/7Cqa2.png
using UnityEngine;
using System.Collections;
public class movingWall : MonoBehaviour
{
public float TimeDown;
bool Anim1;
bool Anim2;
// Use this for initialization
void Start ()
{
TimeDown = Random.Range (10,60);
Anim1 = true;
}
// Update is called once per frame
void Update ()
{
TimeDown -= Time.deltaTime;
if(TimeDown <= 0)
{
TimeDown = Random.Range (10,60);
if(Anim1 == true)
{
animation.Play("wall_move");
Anim1 = false;
Anim2 = true;
}
if(Anim2 == true)
{
animation.Play("wall_move2");
Anim2 = false;
Anim1 = true;
}
}
}
}
↧