private void Move() { pFollower.Move(speed); if (pFollower.position >= 1) { if (loop) { pFollower.position = 0; } else { speed = 0; } } }
void Update() { actualTarget = getActualTarget(); if (actualTarget) { action = ActionController.Chase; timer = timerToSearch; } if (!actualTarget && timer > 0) { action = ActionController.Search; } timer -= Time.deltaTime; if (timer <= 0) { timer = 0; action = ActionController.Move; } if (action == ActionController.Idle) { // une animation joué quand il reste sur place } if (action == ActionController.Chase) { ct.setTarget(actualTarget); ct.Move(); } if (action == ActionController.Search) { st.Move(); } if (action == ActionController.Move) { if (moving == MovingController.Path_Follower && pf) { pf.Move(); } if (moving == MovingController.Random_Move) { //RandomMove rm = GetComponent<RandomMove>(); //rm.Move(); } } }
// Update is called once per frame private void Move() { PathFollower pFollower = GetComponent <PathFollower>(); pFollower.Move(speed); if (pFollower.position >= 1) { if (loop) { pFollower.position = 0; } else { speed = 0; } } }