why the transform.translate doesn't work

public class AI : MonoBehaviour {
public Rect rc;
//public Transform goal;
public float r = 3.0f;

private UnityEngine.AI.NavMeshAgent Enemy;

public EnemyType enemytype = EnemyType.Enemy0 ;
public GameObject player;
private float AIThinkLastTime;
private int state;
private int rotation_state;

// define Enemy condition : stand , rotation , chase , run , attack
private const int Enemy_Stand = 0;
private const int Enemy_Rotation = 1;
private const int Enemy_Chase = 3;
private const int Enemy_Walk = 2;
private const int Enemy_Attact = 4;

// Use this for initialization
void Start() {
Enemy = GetComponent<UnityEngine.AI.NavMeshAgent>();
state = Enemy_Stand;
//rc.x = this.transform.position.x-5f;
//rc.y = this.transform.position.z-5f;
//rc.width = 5;
//rc.height = 5;
//start.position = this.transform.position;
}

// Update is called once per frame
void Update () {

switch (enemytype)
{
case EnemyType.Enemy0:
UpdateEnemy0();
break;
case EnemyType.Enemy1:
UpdateEnemy1();
break;
}

}
void UpdateEnemy0()
{

if (AIthink())
{
print(“think”);
AIthinkEnemyState(3); //Enemy starts action
}
else
{
// print(“updateState”);
UpdateEnemyState();

}
}
bool AIthink()//enemy thinking time
{
if (Time.time - AIThinkLastTime >= 3.0f)//enemy thinks every 3s
{
AIThinkLastTime = Time.time;
return true;
}
return false;
}
void AIthinkEnemyState(int count) //enemy station random
{
int n = new System.Random().Next(count);
print(n);//get a integer under 3
switch (n)
{
case 0:
SetEnemyState(Enemy_Stand);
break;
case 1:
SetEnemyState(Enemy_Rotation);
break;
case 2:
SetEnemyState(Enemy_Walk);
break;
}
}

void SetEnemyState(int newState)
{
if (state == newState)
return;
state = newState;
string animation_name = “idle”;

switch ( state )
{
case Enemy_Stand:
print(“stand”);
animation_name = “idle”;
break;
case Enemy_Rotation:
animation_name = “idle”;
print(“rotate”);
// rotation_state = Random.Range(1,4); //enemy rotates in random angle
rotation_state =new System.Random().Next(4);
break;
case Enemy_Walk:
print(“walk”);
animation_name = “crawl”;
break;
case Enemy_Chase:
print(“chase”);
animation_name = “crawlFast”;
this.transform.LookAt(new Vector3(player.transform.position.x, 0, player.transform.position.z));
break;
case Enemy_Attact:
animation_name = “attack”;
this.transform.LookAt(player.transform.position);
break;
}
if (!this.GetComponent().Play(animation_name))
{

this.GetComponent().Play(animation_name);
}

}

void UpdateEnemy1()
{
if (Vector3.Distance(player.transform.position, this.transform.position) <= 10f)
{
// this.transform.LookAt(player.transform);
this.transform.LookAt(new Vector3(player.transform.position.x, 0, player.transform.position.z));
}
}

void UpdateEnemyState()
{
// float distance = Vector3.Distance(player.transform.position, this.transform.position);
//Enter Tracing Area
if(Mathf.Abs(this.transform.position.x - player.transform.position.x) < 2 * r && Mathf.Abs(this.transform.position.z - player.transform.position.z) < 2 * r)
{
if (Vector3.Distance(player.transform.position, this.transform.position) <= 2f)//Enter Attcking Area
{
SetEnemyState(Enemy_Attact);
}
else
{
SetEnemyState(Enemy_Chase);
}
}
else
{
if (state == Enemy_Attact || state == Enemy_Chase)
SetEnemyState(Enemy_Stand);
this.transform.position = new Vector3(rc.x, 0, rc.y);
}
switch (state)
{
case Enemy_Rotation:
transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.Euler(0, rotation_state * 90, 0), Time.deltaTime * 1); //FROM 0 TO 190 290 390 490
break;

case Enemy_Walk:
print(“move”);
this.transform.Translate(Vector3.forward * 0.02f);
// transform.Translate(Vector3.forward * 0.02f);
// transform.Translate(0, 0, 0.02f);
// print(“move”);
//if (transform.position.z > (rc.y + rc.height))//上边界
//{
// transform.position = new Vector3(transform.position.x, 0, (rc.y + rc.height));
// // transform.Rotate(0, -90f, 0);
// transform.Rotate(0, 180, 0);
//}
//if (transform.position.z < rc.y) //下边界
//{
// transform.position = new Vector3(transform.position.x, 0, rc.y);
// // transform.Rotate(0f, 90f, 0f);
// transform.Rotate(0, 180, 0);
//}
//if (transform.position.x > (rc.x + rc.width))//右边界
//{
// transform.position = new Vector3((rc.x + rc.width), 0 , transform.position.z);
// //transform.Rotate(0f, -90f, 0f);
// transform.Rotate(0, 180, 0);
//}
//if (transform.position.x < rc.x )//左边界/|| transform.position.x >= (rc.x + rc.width) || transform.position.z <= rc.y || transform.position.z >= (rc.y + rc.height))/
//{
// transform.position = new Vector3(rc.x, 0 , transform.position.z);
// // transform.Rotate(new Vector3(0, 90, 0));
// transform.Rotate(0, 180, 0);
//}
break;

case Enemy_Chase:
// transform.Translate(Vector3.forward * 0.02f);
// Enemy.SetDestination(player.transform.position);
break;
case Enemy_Attact:
break;
}

}

}

Please use code tags;

It makes it easy to read the script
and give some background, tell us what is happening why you think it might be failing, what it is for.
Thanks.

you need to be more specific with your question. what part of the script isn’t working. I see you have a few Debug.Log/Print statements. do any of them display? are the animations not playing? do you get any errors?
So much of the code is commented out. it make it harder for us to look at.