protected override void Tick( ) { //if find the target try to approach the target if (bFindTarget) { currentMove = traceMove; if (traceMove.Target != target) { traceMove.SetTarget(target); } Parent.tf.position = traceMove.GetNextPos(Parent.tf.position); } //if not find the target just do RandomRangeMove else { currentMove = rangeMove; targetPos = rangeMove.GetNextPos(Parent.tf.position); Parent.tf.position = targetPos; } //Change jellyfish render direction Render.ChangeDirection(currentMove.IsFacingRight, Parent.tf); }
override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { CheckTouch( ); Parent.tf.position = randMove.GetNextPos(Parent.tf.position); Parent.UpdateRenderDirectionWithFlip(randMove.IsFacingRight, true); }