BehaviorReturnCode wanderAroundPlayer() { Vector2 targetPos; Vector3 playerPos = Memory.Get <GameObject>("Player").transform.position; if (Memory.Contains("targetPos")) { targetPos = Memory.Get <Vector2>("targetPos"); } else { targetPos = Random.insideUnitSphere; Memory.Set <Vector2>("targetPos", targetPos); } if (!isAtTargetPos()) { gameObject.transform.position = Vector3.Lerp(gameObject.transform.position, targetPos + new Vector2(playerPos.x, playerPos.y), speed * Time.deltaTime); return(BehaviorReturnCode.Running); } else { Memory.Remove("targetPos"); return(BehaviorReturnCode.Success); } }