using UnityEngine;
using System.Collections;
public class EnemyAnimation : MonoBehaviour
{
Animation _animation;
void Start()
{
_animation = GetComponentInChildren();
int animToPlay;
string animationToPlay = "";
switch (Random.Range(0, 3))
{
default:
case 0:
animationToPlay = "Move1";
animToPlay = 1;
break;
case 1:
animationToPlay = "Move2";
animToPlay = 2;
break;
case 2:
animationToPlay = "Move3";
animToPlay = 3;
break;
}
_animation[animToPlay].wrapMode = WrapMode.Loop;
_animation.Play(animationToPlay);
_animation[animToPlay].normalizedTime = Random.value;
}
}
Hi guys above is my code, i having problem at the _animation[animToPlay].normalizedTime = Random.value; it says error cs1503:Argument #1 cannot convert 'int' expression to type 'string'
↧